home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / pcc12c.zip / PCC.DOC < prev    next >
Text File  |  1989-06-21  |  177KB  |  5,611 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                                        PCC
  10.  
  11.                               A Personal C Compiler
  12.  
  13.  
  14.                             Version 2.1c  (June 1989)
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.                              U S E R's  M A N U A L
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.                         Manufactured and Distributed by:
  43.  
  44.  
  45.                                C Ware Corporation
  46.                                   P.O. Box 428
  47.                               Paso Robles, CA 93446
  48.  
  49.  
  50.                              (805) 239-4620 [Voice]
  51.  
  52.  
  53.  
  54.  
  55.             Copyright 1989 by C Ware Corporation and DeSmet Software
  56.                                All Rights Reserved
  57.  
  58.  
  59.  
  60.  
  61.                                         1
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                                TABLE OF CONTENTS
  68.  
  69.  
  70.                        T A B L E   O F   C O N T E N T S 
  71.  
  72.           1. The Legal Stuff............................................1
  73.              1.1. License...............................................2
  74.              1.2. Support Policy........................................2
  75.              1.3. DISCLAIMER............................................3
  76.              1.4. FOREIGN RESHIPMENT LIABILITY..........................3
  77.              1.5. LIMITED WARRANTY                                                              ......................................3
  78.              1.6. LIMITATIONS OF REMEDIES...............................3
  79.              1.7. General...............................................4
  80.              1.8. TRADEMARKS............................................4
  81.              1.9. ORDERING INFORMATION..................................4
  82.              1.10. Use by Educational Institutions......................5
  83.              1.11. Corporate, Business, Government and Commercial Use...5
  84.  
  85.           2. Preface....................................................7
  86.  
  87.           3. An Introduction To PCC.....................................8
  88.              3.1. Using Text, Book, Magazine or Download source code....8
  89.              3.2. Getting Started.......................................9
  90.              3.3. PCC Files.............................................9
  91.              3.4. Basic System.........................................10
  92.              3.5. Setting Up DOS 2.xx, 3.xx, ..........................10
  93.              3.6. RAM DISK.............................................11
  94.              3.7. Completion Codes.....................................11
  95.  
  96.           4. PCC -- The Personal C Compiler............................13
  97.              4.1. Introduction.........................................13
  98.              4.2. Examples.............................................14
  99.              4.3. The C Language.......................................15
  100.                   4.3.1. Preprocessor directives.......................15
  101.                   4.3.2. Data Types....................................15
  102.              4.4. Extensions...........................................16
  103.                   4.4.1. Forward References............................18
  104.                   4.4.2. Externs.......................................18
  105.                   4.4.3. Macros........................................20
  106.                   4.4.4. Strings.......................................20
  107.  
  108.           5. The PCCA 8088 Assembler...................................21
  109.              5.1. Introduction.........................................21
  110.              5.2. Invocation...........................................21
  111.              5.3. Example..............................................21
  112.  
  113.           6. The PCCL Object File Linker...............................23
  114.              6.1. Introduction.........................................23
  115.              6.2. Invocation...........................................23
  116.              6.3. Examples.............................................24
  117.              6.4. Space Considerations.................................25
  118.              6.5. Overlays.............................................25
  119.              6.6. Libraries............................................27
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.                                TABLE OF CONTENTS
  134.  
  135.  
  136.           7. The PCCS.S Standard Library...............................28
  137.              7.1. Introduction.........................................28
  138.              7.2. Names................................................28
  139.              7.3. Program Initialization...............................28
  140.              7.4. Calling Conventions..................................29
  141.              7.5. LIBRARY CONVENTIONS..................................31
  142.              7.6. Disk Input/Output Routines...........................32
  143.              7.7. Math Routines........................................33
  144.              7.8. IBM-PC Screen and Keyboard Interface.................34
  145.              7.9. Standard Library Functions...........................34
  146.                   7.9.1. abs().........................................34
  147.                   7.9.2. atoi()........................................34
  148.                   7.9.3. atof()........................................35
  149.                   7.9.4. atol()........................................35
  150.                   7.9.5. ceil()........................................36
  151.                   7.9.6. chain().......................................36
  152.                   7.9.7. close().......................................37
  153.                   7.9.8. creat().......................................37
  154.                   7.9.9. dates().......................................37
  155.                   7.9.10. doint()......................................37
  156.                   7.9.11. exec().......................................38
  157.                   7.9.12. exit().......................................39
  158.                   7.9.13. exp()........................................39
  159.                   7.9.14. fabs().......................................40
  160.                   7.9.15. fclose().....................................40
  161.                   7.9.16. fgetc()......................................40
  162.                   7.9.17. fgets()......................................40
  163.                   7.9.18. floor()......................................41
  164.                   7.9.19. fopen()......................................41
  165.                   7.9.20. fputc()......................................41
  166.                   7.9.21. fputs()......................................42
  167.                   7.9.22. frand()......................................42
  168.                   7.9.23. fscanf().....................................42
  169.                   7.9.24. getc().......................................42
  170.                   7.9.25. getchar()....................................43
  171.                   7.9.26. gets().......................................43
  172.                   7.9.27. getw().......................................44
  173.                   7.9.28. in().........................................44
  174.                   7.9.29. index()......................................44
  175.                   7.9.30. log()........................................44
  176.                   7.9.31. lmove()......................................45
  177.                   7.9.32. longjmp()....................................45
  178.                   7.9.33. open().......................................46
  179.                   7.9.34. os().........................................46
  180.                   7.9.35. out()........................................46
  181.                   7.9.36. peek().......................................46
  182.                   7.9.37. poke().......................................47
  183.                   7.9.38. pow()........................................47
  184.                   7.9.39. putc().......................................47
  185.                   7.9.40. putchar()....................................47
  186.                   7.9.41. puts().......................................48
  187.                   7.9.42. putw().......................................48
  188.                   7.9.43. qsort()......................................48
  189.                   7.9.44. rand().......................................49
  190.                   7.9.45. rename().....................................49
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.                                TABLE OF CONTENTS
  200.  
  201.  
  202.                   7.9.46. rindex().....................................49
  203.                   7.9.47. scanf()......................................50
  204.                   7.9.48. scr_aputs()..................................52
  205.                   7.9.49. scr_ci().....................................52
  206.                   7.9.50. scr_co().....................................52
  207.                   7.9.51. scr_clr()....................................52
  208.                   7.9.52. scr_clrl()...................................52
  209.                   7.9.53. scr_cls()....................................53
  210.                   7.9.54. scr_csts()...................................53
  211.                   7.9.55. scr_cursoff()................................53
  212.                   7.9.56. scr_curson().................................53
  213.                   7.9.57. scr_rowcol().................................53
  214.                   7.9.58. scr_scdn()...................................54
  215.                   7.9.59. scr_scrdn()..................................54
  216.                   7.9.60. scr_scrup()..................................54
  217.                   7.9.61. scr_scup()...................................54
  218.                   7.9.62. scr_setmode()................................54
  219.                   7.9.63. scr_setup()..................................55
  220.                   7.9.64. scr_sinp()...................................55
  221.                   7.9.65. setjmp().....................................56
  222.                   7.9.66. sqrt().......................................56
  223.                   7.9.67. srand()......................................56
  224.                   7.9.68. sscanf().....................................57
  225.                   7.9.69. strcat().....................................57
  226.                   7.9.70. strcmp().....................................57
  227.                   7.9.71. strcpy().....................................57
  228.                   7.9.72. strlen().....................................58
  229.                   7.9.73. strncat()....................................58
  230.                   7.9.74. strncmp()....................................58
  231.                   7.9.75. strncpy()....................................59
  232.                   7.9.76. times()......................................59
  233.                   7.9.77. ungetc().....................................59
  234.                   7.9.78. unlink().....................................59
  235.  
  236.  
  237.         
  238.         Appendices
  239.  
  240.           A. Messages..................................................60
  241.              A.1. PCC Compiler Messages................................60
  242.                   A.1.1. Banner and Termination Messages...............60
  243.                   A.1.2. Messages......................................60
  244.                          A.1.2.1. PCC Fatal Errors.....................60
  245.                          A.1.2.2. PCC Errors...........................62
  246.                          A.1.2.3. PCC Warnings.........................66
  247.                          A.1.2.4. PCCA Errors ( from PCC Execution )...67
  248.              A.2. PCCA Assembler Messages..............................67
  249.                   A.2.1. Banner and Termination Messages...............67
  250.                   A.2.2. Messages Produced by PCCA.....................67
  251.                          A.2.2.1. Fatal Errors From PCCA...............68
  252.                          A.2.2.2. Errors from PCCA.....................68
  253.              A.3. PCCL Messages........................................71
  254.                   A.3.1. Banner and Termination Messages...............71
  255.                   A.3.2. Warnings from PCCL............................71
  256.                   A.3.3. Fatal Errors from PCCL .......................72
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.                                TABLE OF CONTENTS
  266.  
  267.  
  268.  
  269.           B. Order Form................................................74
  270.  
  271.           C. User Comments.............................................75
  272.  
  273.              index.....................................................76
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.                                TABLE OF CONTENTS
  332.  
  333.  
  334.                          L I S T   O F   F I G U R E S 
  335.  
  336.          7-1: Initial Memory Layout....................................29
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                Personal C Compiler
  401.  
  402.                                     PCC 1.2c 
  403.  
  404.  
  405.                          A Product of C WARE CORPORATION
  406.  
  407.                    Copyright (c) 1988, 1989 C WARE CORPORATION
  408.                                All Rights Reserved
  409.  
  410.         PCC is a fully operational and tested 'C' Compiler.  This is NOT 
  411.         cripple-ware.  As a reward for registration, you will receive a 
  412.         disk with several utilities to enhance the compiler:
  413.  
  414.         1. Clist -     reads C source files and produces a listing file 
  415.                        with a symbol cross-reference.
  416.  
  417.         2. Lib88 -     object code librarian.  Reads object files and 
  418.                        other library files and produces library files.
  419.  
  420.         3. Profile -   C program execution profiler.  Monitors program 
  421.                        execution and shows where time is spent in the 
  422.                        program.
  423.  
  424.         4. Xarray -    A library of memory access functions to use the 
  425.                        entire 640K RAM space.  With source.
  426.  
  427.         Registered users are also eligible to purchase several useful 
  428.         utilities to further enhance the capabilities of the compiler.  
  429.  
  430.  
  431.         1. The Legal Stuff
  432.  
  433.         This version of the documentation, software and copyright 
  434.         supersedes all previous versions of PCC.
  435.  
  436.         PCC software copyright (C) 1988, 1989 by C WARE CORPORATION. All 
  437.         rights reserved.
  438.  
  439.         This document copyright (C) 1988, 1989 C WARE CORPORATION.  All 
  440.         rights reserved.
  441.  
  442.         Specifications subject to change without notice.
  443.  
  444.         Most of the hardware names in this manual are trademarks or trade 
  445.         names of specific manufactures.
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.         Legal Stuff                                         Page 2
  464.  
  465.  
  466.         1.1. License
  467.  
  468.         This PCC is NOT public domain or free software, but is being 
  469.         distributed as "shareware".
  470.  
  471.         PCC is copyright (C) 1988, 1989 by C WARE CORPORATION.
  472.  
  473.         Non-registered users of this software are granted a limited 
  474.         license to make an evaluation copy for trial use on a private, 
  475.         non-commercial basis, for the express purpose of determining 
  476.         whether PCC is suitable for their needs.  At the end of this trial 
  477.         period of THIRTY DAYS you MUST either register your copy or 
  478.         discontinue using PCC.
  479.  
  480.         A PCC registration entitles you to use the program on any and all 
  481.         computers available to you, as long as you use the program on 
  482.         only one computer at a time with the following restriction:
  483.  
  484.         All users are granted a limited license to copy PCC only for the 
  485.         trial use of others.  This license does NOT include distribution 
  486.         or copying of this software package:
  487.  
  488.              1. In connection with any other product or service except as 
  489.                 noted below.
  490.              2. For general use within a company or institution.
  491.              3. Distribution in modified form. This license information 
  492.                 MUST be included, along with the full PCC documentation 
  493.                 and all PCC files as released by C WARE CORPORATION.
  494.  
  495.         Operators of electronic bulletin board systems (SYSOPS) are 
  496.         encouraged to post PCC for downloading by users.
  497.  
  498.         If you are the distributor of a public domain or user-supported 
  499.         software library, you may be distribute copies of PCC. A fee of 
  500.         not to exceed $5.00 perdisk may be charged for copy service, 
  501.         handling and materials.  The files MUST be distributed in 
  502.         "archived' form so users may be able to adequately varify the 
  503.         integrity of the files.
  504.  
  505.         The additional utilities available to registered users shall NOT 
  506.         be distributed by any individual or organization other than C 
  507.         WARE CORPORATION.
  508.  
  509.         1.2. Support Policy
  510.  
  511.         The nature of this product and the pricing makes it necessary for 
  512.         us to NOT provide telephone support for users excepting as noted 
  513.         in the pricing schedule below.  We will have to refuse to answer 
  514.         questions unless you have registered the product AND paid for 
  515.         phone support.  Every attempt will be made to address questions 
  516.         left on our support BBS in an appropriate and timely manner. 
  517.         However, this support will be on a when-time-is-available basis 
  518.         and C WARE CORPORATION is NOT responsible to provide support in 
  519.         any form for non-registered or registered users.  Information 
  520.         will be posted on our support BBS when it becomes available as 
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.         Legal Stuff                                         Page 3
  530.  
  531.  
  532.         well as bug fixes or patches.  Upgrades to PCC will be made when 
  533.         appropriate to improve, enhance or correct the product.
  534.  
  535.         1.3. DISCLAIMER
  536.  
  537.  
  538.         The author has taken due care in preparing this manual and the 
  539.         programs and data on the electronic media accompanying this book 
  540.         including research, development, and testing to ascertain their 
  541.         effectiveness.  The author and the publisher make no expressed or 
  542.         implied warranty of any kind with regard to these programs nor 
  543.         the supplemental documentation in this book.  In no event shall 
  544.         the author or C Ware Corporation be liable for incidental or 
  545.         consequential damages in connection with or arising out of the 
  546.         furnishing, performance or use of any of these programs.
  547.  
  548.  
  549.         1.4. FOREIGN RESHIPMENT LIABILITY
  550.  
  551.         THIS LICENSE AGREEMENT IS EXPRESSLY MADE SUBJECT TO ANY LAWS, 
  552.         REGULATIONS, ORDERS OR OTHER RESTRICTIONS ON THE EXPORT FROM THE 
  553.         UNITED STATES OF AMERICA OF SOFTWARE, OR OF INFORMATION ABOUT 
  554.         SUCH SOFTWARE, WHICH MAY BE IMPOSED FROM TIME TO TIME BY THE 
  555.         GOVERNMENT OF THE UNITED STATES OF AMERICA.  NOTWITHSTANDING 
  556.         ANYTHING CONTAINED IN THIS AGREEMENT TO THE CONTRARY, YOU MAY NOT 
  557.         EXPORT, DIRECTLY OR INDIRECTLY, ANY SUCH SOFTWARE OR INFORMATION 
  558.         PERTAINING THERETO TO ANY COUNTRY FOR WHICH SUCH GOVERNMENT OR 
  559.         AGENCY THEREOF REQUIRES AN EXPORT LICENSE OR OTHER SUCH 
  560.         GOVERNMENT APPROVAL AT THE TIME OF EXPORT WITHOUT FIRST OBTAINING 
  561.         SUCH LICENSE OR APPROVAL.
  562.  
  563.         1.5. LIMITED WARRANTY                                                           
  564.  
  565.         PCC IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER 
  566.         EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
  567.         WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
  568.         PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF 
  569.         PCC IS WITH YOU.
  570.  
  571.         SOME STATES DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO 
  572.         THE ABOVE EXCLUSIONS MAY NOT APPLY TO YOU.  THIS WARRANTY GIVES 
  573.         YOU SPECIFIC LEGAL RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS 
  574.         WHICH VARY FROM STATE TO STATE.
  575.  
  576.         C Ware does not warrant that operation of PCC will be 
  577.         uninterrupted or error free.
  578.  
  579.         1.6. LIMITATIONS OF REMEDIES
  580.  
  581.         If C Ware is unable to deliver a copy of PCC that is 
  582.         satisfactory, then you may obtain a full refund by returning all 
  583.         PCC materials and documantation within thirty days of delivery to 
  584.         you as evidenced by a copy of your receipt.
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.         Legal Stuff                                         Page 4
  596.  
  597.  
  598.         This refund is the entire extent of C Ware's liability and your 
  599.         exclusive remedy.
  600.  
  601.         IN NO EVENT WILL C WARE BE LIABLE TO YOU FOR ANY DAMAGES, 
  602.         INCLUDING ANY LOST PROFITS, LOST SAVINGS OR OTHER INCIDENTAL OR 
  603.         CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE 
  604.         PCC EVEN IF C WARE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 
  605.         DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  606.  
  607.         SOME STATES DO NOT ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY 
  608.         FOR INCIDENTAL OR CONSEQUENTAIL DAMAGES SO THE ABOVE LIMITATION 
  609.         OR EXCLUSION MAY NOT APPLY TO YOU.
  610.  
  611.         1.7. General
  612.  
  613.         This Agreement will be governed by the laws of the State of 
  614.         California.
  615.  
  616.         Should you have any questions concerning this Agreement, you may 
  617.         write to C Ware Corporation, PO Box 428, Paso Robles, CA 93447.
  618.  
  619.         YOUR CONTINUED USE OF PCC BEYOND THE THIRTY DAY TRIAL PERIOD, 
  620.         WITH OR WITHOUT REGISTRATION, ACKNOWLEDGES THAT YOU HAVE READ 
  621.         THIS AGREEMENT, UNDERSTAND IT AND AGREE TO BE BOUND BY ITS TERMS 
  622.         AND CONDITIONS.  YOU FURTHER AGREE THAT IT IS THE COMPLETE AND 
  623.         EXCLUSIVE AGREEMENT BETWEEN US WHICH SUPERSEDES ANY PROPOSAL OR 
  624.         PRIOR AGREEMENT, ORAL OR WRITTEN, ANY ANY OTHER COMMUNICATIONS 
  625.         BETWEEN US RELATING TO THE SUBJECT MATTER OF THIS AGREEMENT.
  626.  
  627.         1.8. TRADEMARKS
  628.  
  629.         MS-DOS is a registered trademark of Microsoft Corporation.
  630.         PC-DOS is a registered trademark of IBM Corporation.
  631.         Compaq is a registered trademark of Compaq Inc.
  632.         Tandy 1000 is a registered trademark of Tandy Corporation.
  633.  
  634.  
  635.         1.9. ORDERING INFORMATION
  636.  
  637.         A PCC registration licenses you to use the product on a regular 
  638.         basis.  Users need register only one version of PCC, registration 
  639.         includes licensed use of all upgrades.  Registered users can 
  640.         always get the most current version of the program at a nominal 
  641.         fee ($5.00 as of this writing) by calling or writing C WARE 
  642.         CORPORATION.  The latest version will also be available on the 
  643.         following "official distribution BBSs":
  644.  
  645.         1. PYSMATIC BBS, Sunnyvale, CA  (408)-992-0372 
  646.  
  647.  
  648.         If you purchased PCC through a distributor of public domain or 
  649.         user-supported software, you did NOT pay for the license.  The 
  650.         fee ($5.00 max per disk) was to cover the costs of copying the 
  651.         disk(s), the media and handling overhead.  You paid for the 
  652.         vendors service.
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.         Legal Stuff                                         Page 5
  662.  
  663.  
  664.  
  665.         Registration for PCC costs $30 and assumes you have already 
  666.         received a copy of the program from whatever source.  We will 
  667.         also send you the next major upgrade of PCC when it is released OR 
  668.         if you ask, we will send you a certified copy of the current 
  669.         version of the program and you must download, purchase or send us 
  670.         $5.00 to get the next version. 
  671.  
  672.         1.10. Use by Educational Institutions
  673.  
  674.         Educational institutions wishing to use PCC for courses involving 
  675.         C MUST obtain a site license.  State or city operated 
  676.         institutions shall pay $10.00 per student using the program.  
  677.         Private or commercial institutions shall pay $15.00 per student 
  678.         using the program.  All reproduction of documentation and media 
  679.         shall be done by the licensed site institution.  The additional 
  680.         utilities offered to registered users may be purchased at 66% off 
  681.         for state or city operated institutions and 50% off for private 
  682.         or commercial institutions.    
  683.               
  684.         Students using the program via this method are NOT registered 
  685.         users and must register their copy as per the licensing agreement 
  686.         for an indivdual if they use the program after completion or 
  687.         termination of the course.
  688.  
  689.         1.11. Corporate, Business, Government and Commercial Use
  690.  
  691.         Corporate, business, government or other commercial uses of PCC is 
  692.         PROHIBITED.  We offer an excellent C Development Package for such 
  693.         commercial users.  Please contact C WARE CORPORATION directly for 
  694.         information and pricing. The intent of PCC is to provide a low 
  695.         cost base for persons interested in learning C or using C 
  696.         primarily for programs for self used programs.  If you find you 
  697.         wish to sell a program developed with PCC, you must do the 
  698.         following:
  699.  
  700.              1. The program and documentaion must prominently indicate 
  701.                 the code was compiled with PCC (c) 1988, 1989 C WARE 
  702.                 CORPORATION.
  703.  
  704.              2. Get written permission ( which is no big problem ) by 
  705.                 sending us a copy of the program as it is to be sold or 
  706.                 distributed.  A letter granting permission will be sent 
  707.                 promptly, if your package meets the requirements of 
  708.                 paragraph 1 above.
  709.  
  710.  
  711.                 ALL PRICES ARE SUBJECT TO CHANGE WITHOUT NOTICE.
  712.  
  713.  
  714.         Please use the order form in Appendix C when placing an order.
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.         Legal Stuff                                         Page 6
  728.  
  729.  
  730.         You can also register/order your copy of PCC by phone, using your 
  731.         MasterCard or VISA.  Phone (805)-239-4620, 9:00 - 4:00 p.m. PST 
  732.         or PDT only.
  733.  
  734.         Sorry, C.O.D. orders will NOT be accepted.
  735.  
  736.         ORDERS OUTSIDE THE US: Please use your Mastercard or VISA when 
  737.         ordering,  or  send checks drawn on US banks in US dollars.   All 
  738.         checks must have US bank magnetic routing symbols.  Please 
  739.         include an additional $5 to cover postage on orders to be sent 
  740.         outside of the US.
  741.  
  742.         Full-time students can apply a 10% discount on all prices. You 
  743.         MUST include your a photo-copy of your most recent registration 
  744.         slip and student ID card.
  745.  
  746.         PRICE SCHEDULE AND INFORMATION ( November 1988 )
  747.  
  748.              1. Individual Registration              -        $30.00
  749.                 - Copy of program sent if requested
  750.                 - Utility package sent automatically
  751.  
  752.            *** Below items only available to registered users. ***
  753.  
  754.              2. Editor                               -        $10.00
  755.  
  756.              3. Debugger                             -        $15.00
  757.  
  758.              4. MS DOS Linker compatability utility  -        $ 5.00
  759.  
  760.              5. Special utilities package            -        $ 5.00
  761.  
  762.              6. Five phone support calls (5-min).    -        $15.00
  763.                 - Total 25 minutes of help time
  764.  
  765.          
  766.  
  767.         NOTES:
  768.           
  769.              1. The above prices include CA sales tax.
  770.  
  771.              2. Sorry, we do not have a printed manual available.
  772.  
  773.              3. For fastest service please send Money Order or use Visa 
  774.                 or MasterCharge.  We must wait 10 days for personal 
  775.                 checks to clear.
  776.  
  777.              4. Please allow 30 days for delivery.  Money order, Visa and 
  778.                 MasterCharge should ship in two(2) working days but 
  779.                 things do get hectic at times.  Drop us a line if you 
  780.                 haven't got your order in 15 days.
  781.  
  782.              5. Please use the form in appendix F to order.
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.         Preface                                             Page 7
  794.  
  795.  
  796.         2. Preface
  797.  
  798.  
  799.         The PCC package would not exist but for the tireless work of 
  800.         L. B. Neal.  He has called us, badgered us, sent us manuals and 
  801.         materials, jumped up and down about the virtues of Shareware, and 
  802.         in general demanded that we transform the DeSmet C package into 
  803.         PCC.
  804.  
  805.         The PCC package also owes everything to the incredible work of 
  806.         Mark DeSmet.  At a time when most programmers couldn't spell 'C', 
  807.         Mark wrote a compiler, assembler, linker and library for not one 
  808.         operating system, but two.  The fact that it is still the fastest 
  809.         C compiler in the current benchmarks further attests to Mark's 
  810.         skills.
  811.  
  812.         This manual describes the C Ware Personal C Compiler for the IBM-
  813.         PC personal computer and the other MS-DOS based personal 
  814.         computers.  It is based on the DeSmet C Development Package.  If 
  815.         you are unfamiliar with the C language or UNIX, the book The C 
  816.         Programming Language (First edition -- the Second edition contains 
  817.         features and enhancements of ANSI C not found in PCC) by Brian 
  818.         Kernighan and Dennis Ritchie is available.  If you plan on coding 
  819.         in assembly language, it is advisable to get a manual on the 
  820.         Intel 8086 microprocessor.   Books such as Intel's ASM86 Language 
  821.         Reference Manual or The 8086 Family User's Guide are good 
  822.         choices.  These manuals fully describe the architecture and the 
  823.         instruction set of the 8086/8088 family of microprocessors.
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.         An Introduction to PCC                              Page 8
  860.  
  861.  
  862.         3. An Introduction To PCC
  863.             
  864.         Now that we made it through all of the formalities lets take a 
  865.         look at what PCC contains.
  866.  
  867.              PCC is a fast powerful C compiler.  It is fully compatable 
  868.              with code written for DeSmet Ver: 2.51. Code for earlier 
  869.              versions of DeSmet should work with minimal adjustment.
  870.  
  871.              This compiler is NOT full of bells and whistles it just 
  872.              makes fast tight compact programs.
  873.  
  874.              Some of the terms and conventions of PCC a bit different than 
  875.              what you may find in a text or book on the C language, so we 
  876.              will first do a quick run through the terms used in 
  877.              PCC12B.DOC.
  878.  
  879.              TEXT OR BOOK NAME        PCC NAME         COMMENT
  880.  
  881.              LINK                     PCCL             Builds .EXE file
  882.  
  883.              filename.obj             filename.o       Basis for .EXE file
  884.  
  885.              filename.asm             filename.a       Assembly source file
  886.  
  887.              MASM or ASM              PCCA             8088/8086 Assembler
  888.  
  889.              CC or CPP                PCC              Main Compiler 
  890.                                                        (First Pass)
  891.              CC1                      PC2              Compiler Second Pass
  892.  
  893.         3.1. Using Text, Book, Magazine or Download source code
  894.  
  895.         Many C compilers are around and so are an almost equal number of 
  896.         variations of interpretation of what C syntax should be.  And 
  897.         then there are the extensions to support I/O, machine specific 
  898.         functions, etc. Source NOT written for PCC or DeSmet Ver: 2.51 
  899.         will have to have minimally minor adjustments made to be accepted 
  900.         by the PCC compiler and to run properly.
  901.  
  902.         In fact finding, compiling and modifying source code is an 
  903.         excellent way to learn any language or compiler.  Just be careful 
  904.         to not adopt bad habits from exposure to poorly written code, 
  905.         i.e. keep your eyes open.
  906.  
  907.  
  908.         *****************************************************************
  909.  
  910.         CAUTION: PCC will accept any valid code you supply to it, as will 
  911.         any compiler.  The code may well be valid, but the result of the 
  912.         code may well be dangerous to the health and safety of your 
  913.         computer, monitor or contents of your Hard Drive or floppies ( 
  914.         and it WILL be at one time or another ).  Guard and maintain 
  915.         uptodate copies of all files on your system.  If your program or 
  916.         the compiler starts to act erratic: i.e. screen goes blank, funny 
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.         An Introduction to PCC                              Page 9
  926.  
  927.  
  928.         video display, noises from hardware, or any strange unexpected 
  929.         actions., IMMEDIATELY TURN OFF THE POWER to the computer and 
  930.         investigate carefully after you have the system rebooted.
  931.  
  932.         ******************************************************************                   
  933.  
  934.         THE REST IS UP TO YOU
  935.  
  936.         C is a powerful and useful language, we hope you find PCC a help 
  937.         to your learning and use of the C language.
  938.  
  939.         Your comments and suggestions on how to improve our product are 
  940.         welcome.
  941.  
  942.         Enjoy your adventure into the land of C and we hope your programs 
  943.         help you in your computing.
  944.  
  945.         3.2. Getting Started
  946.  
  947.         First things first.  Copy all of the files from the distribution 
  948.         disks onto a set of working floppy diskettes or hard disk.  The 
  949.         package is not copy-protected so the MS-DOS copy command can be 
  950.         used to copy the files.  The package is distributed on a single 
  951.         double-sided (360KB) diskette.  The distribution diskette should 
  952.         never be used, it should be kept as the backup copy of PCC.
  953.  
  954.         Lets make sure the compiler files are intact.  A source program 
  955.         called DUMP.C has been provided in this package.  Place the files 
  956.         from PCC12B.DWC in a directory of your choice or on floppy disks 
  957.         per the later documentation.  To compile DUMP.C enter
  958.  
  959.              >PCC DUMP
  960.  
  961.         This will compile DUMP.C into an object module DUMP.O.  To link 
  962.         DUMP.O with the required library functions in PCCS.S enter
  963.  
  964.              >PCCL DUMP
  965.  
  966.         This will produce a file DUMP.EXE.  To run DUMP.EXE enter
  967.  
  968.              >DUMP DUMP.C
  969.  
  970.         This will produce a hex and ascii dump of DUMP.C on your screen.  
  971.         If DUMP runs correctly, then the compiler should be in good 
  972.         working order.
  973.  
  974.         3.3. PCC Files
  975.  
  976.         The package is distributed as an archive file -- PCC.DWC -- so 
  977.         that integrity checks may be run.  PCC.DWC contains the following 
  978.         files:
  979.  
  980.         BUF128.A       Source code for BUF128.EXE.
  981.         BUGS!.EXE      Arcade game (use 'BUGS!   c' for color displays).
  982.         CTYPE.H        Include file for character typing macros.
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.         An Introduction to PCC                              Page 10
  992.  
  993.  
  994.         DUMP.C         Source code for DUMP.EXE.
  995.         EXEC.O         The Exec() and Chain() functions.
  996.         ISETUP.A       Run-time startup source code.
  997.         LATER.C        Source code for a file modification date checking 
  998.                        program.
  999.         LIFE.C         Source code for LIFE.EXE.
  1000.         MATH.H         Include file for the Standard Math package.
  1001.         PC2.EXE        The second pass of the C compiler.
  1002.         PCC.DOC        This file
  1003.         PCC.EXE        The first pass of the C compiler.
  1004.         PCC7.S         The standard C function library with 8087 support.  
  1005.                        To use this library, rename it to PCCS.S.
  1006.         PCCA.EXE       The assembler and third pass of the C compiler.
  1007.         PCCL.EXE       The object file linker.
  1008.         PCCS.S         The standard C function library with software 
  1009.                        floating-point support.
  1010.         RAM.COM        RAM Disk driver for DOS 2.0 and later operating 
  1011.                        systems.
  1012.         PCIO.A         Source code for the PC screen functions.
  1013.         SETJMP.H       Include file for non-local jumps
  1014.         STDIO.H        Include file for the Standard I/O package.
  1015.  
  1016.  
  1017.         3.4. Basic System
  1018.  
  1019.         The minimum files you need from PCC.ARC are PCC.EXE, PC2.EXE, 
  1020.         PCCA.EXE, and PCCS.S.  The files STDIO.H and MATH.H contain 
  1021.         useful declarations.
  1022.  
  1023.         If you are developing in a directory other than the one that 
  1024.         contains the PCC files, be sure to set the PATH environment 
  1025.         variable to include the PCC directory.
  1026.  
  1027.         3.5. Setting Up DOS 2.xx, 3.xx, ...
  1028.  
  1029.         For systems utilizing DOS 2.x or later versions of the operating 
  1030.         systems, make sure that the ASCII text file CONFIG.SYS exists on 
  1031.         your boot disk.
  1032.           
  1033.         The file must contain the line:
  1034.  
  1035.                 FILES=20
  1036.  
  1037.         since PCC supports 20 open files Q stdin, stdout, stderr, and 17 
  1038.         other files.  The default number of eight is insufficient for the 
  1039.         PCCL program.
  1040.  
  1041.         If there is enough memory available, add the line:
  1042.  
  1043.                 BUFFERS=20
  1044.  
  1045.         to improve file performance in the operating system.  512 bytes 
  1046.         are allocated for each buffer specified.
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.         An Introduction to PCC                              Page 11
  1058.  
  1059.  
  1060.         3.6. RAM DISK
  1061.  
  1062.         If you have a system with more than 256 kilobytes of memory, then 
  1063.         the Ram Disk driver RAM.COM can be used to create an  extremely 
  1064.         fast disk.  To add a Ram Disk, copy the RAM.COM file from the 
  1065.         distribution diskette to the system disk and add the line:
  1066.  
  1067.                 DEVICE=RAM.COM   n
  1068.  
  1069.         to the CONFIG.SYS file.  The parameter, n, is a decimal number 
  1070.         from 32 to 650 indicating the size of the Ram Disk.  The value is 
  1071.         specified in units of one kilobyte (1024).  
  1072.  
  1073.         Re-boot the system to install the Ram Disk.  The drive letter 
  1074.         used for this 'disk drive' is dependent on the configuration of 
  1075.         the system.  DOS will install the Ram Disk at the first free 
  1076.         device "slot".  For an IBM PC with two floppies, this will 
  1077.         probably be drive C:.  For an XT, it will probably be drive D:.  
  1078.         Sanyo 550/5 reserves the first four slots for its floppies, so 
  1079.         the Ram Disk is drive E:.  To find where DOS has installed the 
  1080.         Ram Disk, use
  1081.  
  1082.                 chkdsk x:
  1083.  
  1084.         where x takes on the values c, d, ....  You will get either a 
  1085.         disk error, or a return showing the size of the Ram Disk.  Once 
  1086.         you find it, the Ram Disk will always be the same until you add 
  1087.         other device drivers before it in the CONFIG.SYS file.
  1088.  
  1089.         3.7. Completion Codes
  1090.  
  1091.         The PCC, PCCA, and PCCL programs set the completion code to:
  1092.  
  1093.                  zero  if no warnings or errors occurred,
  1094.                  one  if warnings were issued, and
  1095.                  two if errors occurred.
  1096.  
  1097.         Batch files can take advantage of these values to stop execution 
  1098.         or otherwise handle these exceptional cases.
  1099.  
  1100.         The following batch file will stop on a PCC or PCCL error:
  1101.  
  1102.              PCC %1
  1103.              if errorlevel 1 goto stop
  1104.              bind %1
  1105.              if errorlevel 1 goto stop
  1106.              %1
  1107.              :stop
  1108.  
  1109.         More complicated development situations can be handled with the 
  1110.         program LATER which is supplied in source form in the file 
  1111.         LATER.C.  LATER takes a list of filenames as arguments.  It sets 
  1112.         the errorlevel to one if the last file does not exist or if the 
  1113.         last file has an earlier modification date than any other file in 
  1114.         the list.  It can only be used on systems with a battery backup 
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.         An Introduction to PCC                              Page 12
  1124.  
  1125.  
  1126.         clock or where users are careful about setting the date and time 
  1127.         when the system is brought up.  Assume a program is composed of 
  1128.         the files moda.c, modb.c, modc.c and the include file mod.h.  The 
  1129.         following .BAT file can be used to regenerate the program 
  1130.         whenever a module changes:
  1131.  
  1132.              later moda.c mod.h moda.o
  1133.                   if errorlevel 1 PCC moda
  1134.                        if errorlevel 1 goto stop
  1135.              later modb.c mod.h modb.o
  1136.                   if errorlevel 1 PCC modb
  1137.                        if errorlevel 1 goto stop
  1138.              later modc.c mod.h modc.o
  1139.                   if errorlevel 1 PCC modc
  1140.                        if errorlevel 1 goto stop
  1141.              later moda.o modb.o modc.o mod.exe
  1142.                   if errorlevel 1 bind moda modb modc -omod
  1143.              :stop
  1144.  
  1145.         This provides a service similar to the UNIX MAKE program.  Only 
  1146.         those files that need to be compiled will be compiled.
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.         PCC -- The Personal C Compiler                      Page 13
  1190.  
  1191.  
  1192.         4. PCC -- The Personal C Compiler
  1193.  
  1194.         4.1. Introduction
  1195.  
  1196.         PCC is the C compiler for the 8088/8086 family of 
  1197.         microprocessors.  It accepts C source programs as input and 
  1198.         produces object files. The model employed by the compiler 
  1199.         efficiently utilizes the 8088/8086 architecture but limits a 
  1200.         program to 64KB code and 64KB of data.
  1201.  
  1202.  
  1203.         Invocation
  1204.  
  1205.            PCC <filename> [options]
  1206.  
  1207.         <filename> is the name of the file containing the C source. If it 
  1208.                    does not include an extension, the extension '.C' is 
  1209.                    assumed.
  1210.  
  1211.         Options: The case of the option is not significant. Each option 
  1212.         should be separated from other options by blanks.  Options may be 
  1213.         preceded with the dash (-) character.
  1214.  
  1215.         A          - assembly output.  This option indicates that the 
  1216.                    compiler should produce an assembly language source 
  1217.                    file instead of an object file.  The name of the 
  1218.                    assembly language file will be the same as the name of 
  1219.                    the source file but will have the extension '.A'.
  1220.  
  1221.         D<name>    - compiler drive specification.  The compiler assumes 
  1222.                    that the files GEN.EXE and ASM88.EXE are in the 
  1223.                    default directory on the current drive.  This option 
  1224.                    is used to inform the compiler that the files are on a 
  1225.                    different drive.  For example, if the compiler is on 
  1226.                    drive 'M', then the option 'DM' is needed.
  1227.  
  1228.                    Under MS-DOS 2.0 and later versions of the operating 
  1229.                    system, this option is rarely  needed as the system 
  1230.                    PATH variable is also used to find the other passes of 
  1231.                    the compiler.
  1232.  
  1233.         I<name>    - include path name.  This option overrides the 
  1234.                    default drive/directory for files included with the 
  1235.                    #include control. The directory name must end with a 
  1236.                    trailing backslash (\) character  (e.g. -
  1237.                    ic:\src\include\).  See section 4.4.1 for #include 
  1238.                    details.
  1239.  
  1240.         N<defname>=<defvalue> - specify #define  name and value.  Used to 
  1241.                    set debugging switches or constant values without 
  1242.                    editing the file.  This option is equivalent to
  1243.  
  1244.                         #define defname defvalue
  1245.  
  1246.                    at the begining of the program.
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.         PCC -- The Personal C Compiler                      Page 14
  1256.  
  1257.  
  1258.                    To set <defname> to one, enter n<defname>, which is 
  1259.                    equivalent to
  1260.  
  1261.                         #define defname 1
  1262.  
  1263.                    Spaces are not allowed.
  1264.  
  1265.         O<filename> - output filename.  The compiler will produce an 
  1266.                    object file with the specified name.  If the name 
  1267.                    lacks an extension, the extension '.O' will be added.  
  1268.                    The default object name is the same as the source name 
  1269.                    with the extension of '.O'.
  1270.  
  1271.         T<drive>   - specifies the drive that the compiler should use for 
  1272.                    its temporary files.  If not specified, the compiler 
  1273.                    will build its temporary files on the default drive.  
  1274.                    If this drive is close to being full, the 'T' option 
  1275.                    should be used to change the drive for the 
  1276.                    temporaries.  Also, if the RAM Disk has been 
  1277.                    installed, placing the temporary files there will 
  1278.                    drastically cut the amount of time needed to compile a 
  1279.                    program.
  1280.  
  1281.  
  1282.         4.2. Examples
  1283.  
  1284.         PCC blip
  1285.                    compiles the file named blip.c.  The object file will 
  1286.                    be named blip.o.
  1287.  
  1288.         m:PCC b:blip.ccc tm dm
  1289.  
  1290.                    runs the compiler from drive M on the file b:blip.ccc.  
  1291.                    Temporary files are also written on drive M.  Note the 
  1292.                    use of the D option to indicate the location of the 
  1293.                    other passes of the compiler.  The object file will 
  1294.                    also be named blip.o.
  1295.  
  1296.         PCC blip -ic:\inc\ -a -nNewVersion -nNYear=1985
  1297.  
  1298.                    compiles the file named blip.c.  Include files are 
  1299.                    taken from the directory c:\inc\.  An assembly 
  1300.                    language file is generated named blip.a.  The 'N' 
  1301.                    options are equivalent to adding
  1302.  
  1303.                         #define NewVersion 1
  1304.                         #define NYear       1985
  1305.  
  1306.                    to the start of blip.c
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.         PCC -- The Personal C Compiler                      Page 15
  1322.  
  1323.  
  1324.         4.3. The C Language
  1325.  
  1326.         PCC compiles C programs that conform to the standard definition 
  1327.         of the C language as described in the book The C Programming 
  1328.         Language  by Brian W. Kernighan and Dennis M. Ritchie.  The 
  1329.         following documentation describes the implementation.
  1330.  
  1331.         4.3.1. Preprocessor directives
  1332.  
  1333.         #define    defines a macro with or without parameters. 
  1334.  
  1335.         #undef, #ifdef and #ifndef - tests the status of the #defined 
  1336.                    macros 
  1337.  
  1338.         #include   includes other files into the program. #include's 
  1339.                    can be nested to a maximum depth of 3.
  1340.  
  1341.                    #include "filename" will search the default directory 
  1342.                    for the file filename.  #include <filename> will first 
  1343.                    search the default directory for filename.  If the 
  1344.                    file was not found, the environment (see DOS 2.X/3.X 
  1345.                    SET command) is searched for the variable INCLUDE .  
  1346.                    If the variable is found, it is assumed to contain a 
  1347.                    set of directory prefixes separated by semi-colons.  
  1348.                    For example, if INCLUDE is set as follows
  1349.                 
  1350.                         C>set include=c:\;c:\usr\include\
  1351.  
  1352.                    then the line
  1353.  
  1354.                         #include <world.h>
  1355.  
  1356.                    would cause PCC to search for
  1357.  
  1358.                         world.h
  1359.                         c:\world.h
  1360.                         c:\usr\include\world.h
  1361.  
  1362.         #if, #else, #endif - conditionally includes or excludes source 
  1363.                    statements.
  1364.  
  1365.         4.3.2. Data Types
  1366.  
  1367.         char       Unsigned byte with a range of 0 to 255.
  1368.  
  1369.         int
  1370.         short      Signed Integer with a range of -32768 to 32767.
  1371.  
  1372.         unsigned   Unsigned integer with a range of 0 to 65535.
  1373.  
  1374.         long       Signed integer with a range of -2147483648 to 
  1375.                    2147483647.
  1376.  
  1377.         float      Four byte floating point value.  A float number has 
  1378.                    about 7 digits of precision and has a range of about 
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.         PCC -- The Personal C Compiler                      Page 16
  1388.  
  1389.  
  1390.                    1.E-36 to 1.E+36. The floating point formats are 
  1391.                    defined by the IEEE floating-point standard.
  1392.  
  1393.         double     Eight byte floating point value.  A double number has 
  1394.                    about 13 digits of precision and a range of about 1.E-
  1395.                    303 to 1.E+303.
  1396.  
  1397.         (pointer)  pointers are two bytes, limiting total data space to 
  1398.                    64KB.
  1399.  
  1400.         To take advantage of the 8088/8086 instruction set, expressions 
  1401.         involving only char  types are not coerced to int before 
  1402.         evaluation.  The sum of a char equal to 255 and a char equal to 1 
  1403.         is 0 rather than 256.  Constants are considered to be int values 
  1404.         so that constant plus char is a two byte integer operation.
  1405.  
  1406.         4.4. Extensions
  1407.  
  1408.         The UNIX Version 7 extensions -- enumerated types, extended 
  1409.         member name-space, and structure assignment are fully supported.
  1410.  
  1411.         Enumerated types provide a convenient method of declaring an 
  1412.         ordered set of named constants.  Values start with zero, and may 
  1413.         be reassigned with a name = value expression.  The same value may 
  1414.         be assigned to several names.  For example
  1415.  
  1416.                 enum color {red, blue=4, green} ca, *cp;
  1417.                 enum color cb;
  1418.                 if(ca == red)
  1419.                         cb = green;
  1420.         is equivalent to
  1421.  
  1422.                 #define red   0
  1423.                 #define blue  4
  1424.                 #define green 5
  1425.                 int ca, *cp;
  1426.                 int cb;
  1427.                 if(ca == red)
  1428.                         cb = green;
  1429.  
  1430.  
  1431.         Extended member name-space relaxes the K&R requirement that if a 
  1432.         member name appeared in more than one structure or union, then it 
  1433.         had to have the same data type and offset in every appearance.  
  1434.         Now, the only restriction is that the member name must be unique 
  1435.         within the structure or union.  If a member name is used that is 
  1436.         not in the referenced structure, the warning
  1437.  
  1438.                 member not in structure
  1439.  
  1440.         is issued.  As a loophole, a pointer to char may be used as an 
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.         PCC -- The Personal C Compiler                      Page 17
  1454.  
  1455.  
  1456.         anonymous pointer to any structure.
  1457.                 struct {int i, j, k;} zip;
  1458.                 struct {int j; char i;} zap, *zp;
  1459.                 char *cp;
  1460.  
  1461.                 zip.i = 1;      /* OK */
  1462.                 zap.i = 1;      /* OK */
  1463.                 zap.k = 1;      /* WARNING */
  1464.                 zp->i = 1;      /* OK */
  1465.                 zp->k = 1;      /* WARNING */
  1466.                 cp->k = 1;      /* OK, ANONYMOUS */
  1467.  
  1468.         Structures can be assigned, used as parameters, or returned from 
  1469.         a function.  CAUTION: this may create problems with existing 
  1470.         programs because previous versions of PCC converted the name of a 
  1471.         structure in a parameter list to a pointer to that structure, 
  1472.         while the current release pushes the entire structure.  To 
  1473.         highlight this potential problem, PCC will issue the following 
  1474.         warning
  1475.  
  1476.                 structure assignment
  1477.  
  1478.         when structures are passed by value, and the warning
  1479.  
  1480.                 returns structure
  1481.  
  1482.         when a function returns a structure.  These warnings will be 
  1483.         removed in a future release.
  1484.                 
  1485.                 struct z {int i, j;} zip, zap, zxax();
  1486.                 main(){
  1487.                         zip = zap;  /* structure assignment */
  1488.                         zap = zmax(zip, zap);
  1489.                         }
  1490.                 struct z zmax(a,b) /* func returns struct */
  1491.                         struct z a, b; {
  1492.                         if(a.i > b.i)
  1493.                                 return a;
  1494.                         return b;
  1495.                         }
  1496.  
  1497.         Variable names are significant to 31 characters instead of 8.
  1498.  
  1499.         A #asm directive has been included to allow in-line assembly 
  1500.         language code for time critical applications.  All lines 
  1501.         following a line starting with #asm are  passed through to the 
  1502.         assembler.  The next line beginning with the "#' character, ends 
  1503.         the in-line assembly code.
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.         PCC -- The Personal C Compiler                      Page 18
  1520.  
  1521.  
  1522.         For example:
  1523.  
  1524.                 _move(count, src, tar)
  1525.                 int count; char *src, *tar; {
  1526.                 #asm
  1527.                         MOV             CX,[BP+4] ;count
  1528.                         MOV             SI,[BP+6] ;src
  1529.                         MOV             DI,[BP+8] ;dst
  1530.                         MOV             AX,DS
  1531.                         MOV             ES,AX
  1532.                         CLD
  1533.                         REP MOVSB
  1534.                 #
  1535.                         }
  1536.  
  1537.         4.4.1. Forward References
  1538.  
  1539.         PCC is effectively a one pass compiler so forward references will 
  1540.         not work.  The following program:
  1541.  
  1542.               main() {
  1543.                   i=99;
  1544.                   }
  1545.              extern int i;
  1546.  
  1547.         will produce a warning that 'i' is undefined and is assumed to be  
  1548.         a local variable named 'i'.  The global variable 'i' will not be 
  1549.         changed.
  1550.  
  1551.         Structure tags must be defined before being referenced.  The only 
  1552.         exception is pointers, so that legal structure declarations 
  1553.         include structures of the form:
  1554.  
  1555.  
  1556.             struct a {
  1557.                 struct b *x;
  1558.                 }
  1559.  
  1560.             struct b {
  1561.                 struct a *y;
  1562.                 }
  1563.  
  1564.  
  1565.         4.4.2. Externs
  1566.  
  1567.         The rules for 'extern' declarations are:
  1568.  
  1569.         1.   Statements that are global to the source file, like 'int 
  1570.              blip;' may be in several different files that are linked 
  1571.              together.  The BINDer will allocate 2 bytes for the global 
  1572.              integer variable blip.  This is an extension to the standard 
  1573.              rule that restrict global declarations to a single file and 
  1574.              require all the other declarations to be extern.
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.         PCC -- The Personal C Compiler                      Page 19
  1586.  
  1587.  
  1588.         2.   A declaration that includes the keyword 'extern' may not 
  1589.              include initializers and does not allocate any memory.  Thus 
  1590.              a variable so declared must be declared somewhere else 
  1591.              without the 'extern' keyword in order to reserve memory for 
  1592.              the variable.  For example, if a file contains the 
  1593.              declaration extern int blip   then some other file must 
  1594.              contain the declaration   int blip to actually allocate 
  1595.              storage.  If this is not done, the binder will complain 
  1596.              about a reference to the unresolved symbol blip.  It is 
  1597.              permissible to have both an 'extern' and non-'extern' 
  1598.              declaration in a single file.  For example,
  1599.  
  1600.  
  1601.                 extern int blip;
  1602.                 int blip;
  1603.  
  1604.              is valid.
  1605.  
  1606.         To create include files containing data declarations -- if the 
  1607.         variable is not initialized (which means it will be initialized 
  1608.         with zeros) either include the declaration:
  1609.  
  1610.                 int blip;
  1611.  
  1612.         in every file or include the declaration:
  1613.  
  1614.                 extern int blip;
  1615.  
  1616.         in every file and add the declaration:
  1617.  
  1618.                 int blip;
  1619.  
  1620.         to one of the files to actually allocate the storage.
  1621.  
  1622.         If the variable needs initialization, the second approach must be 
  1623.         used.  Include the declaration:
  1624.  
  1625.                 extern int blip;
  1626.  
  1627.         in the include file.  Initialize the value in only one file:
  1628.  
  1629.                 int blip = 1985;
  1630.  
  1631.         These rules are about the same as Version 7 UNIX.  Extern rules 
  1632.         are an area of C that are currently controversial.  System V UNIX 
  1633.         tried to tighten up the rules but enough people complained that 
  1634.         5.2 is back to normal.
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.         PCC -- The Personal C Compiler                      Page 20
  1652.  
  1653.  
  1654.         4.4.3. Macros
  1655.  
  1656.         Macro arguments are not replaced within a quoted string.   For 
  1657.         example, in The C Puzzle Book by Alan Feuer the macros in 
  1658.         <defs.h> use the following construct to customize printf() calls.
  1659.  
  1660.                 #define PR(fmt,v)printf("value=%fmt%t",v);
  1661.  
  1662.         This does not work with the PCC compiler.  Instead add the 
  1663.         following defines to <defs.h>:
  1664.  
  1665.                 #define D "value = %d%t"
  1666.                 #define F "value = %f%t"
  1667.                 #define C "value = %c%t"
  1668.                 #define G "value = %g%t"
  1669.  
  1670.         and change the PR define to
  1671.  
  1672.                 #define PR(fmt,v)printf(fmt,(v));
  1673.  
  1674.         Statements of the type
  1675.  
  1676.             PRINT1(d,x);
  1677.  
  1678.         must be changed to
  1679.  
  1680.             PRINT1(D,x);
  1681.  
  1682.         in the programs.  Lower case D, F, C, and G's would allow the 
  1683.         programs to remain unchanged but variables c and g are used in 
  1684.         structure one and variable g is used in structures two and three.
  1685.  
  1686.  
  1687.         4.4.4. Strings
  1688.  
  1689.         Literal character strings delimited by quotes ('\"') cannot 
  1690.         contain the NUL character ('\0').  The compiler terminates the 
  1691.         string at the NUL character, even though it checks that the 
  1692.         string has a terminating quote character.  If you want NUL 
  1693.         characters in the string for initialization purposes, use an 
  1694.         array assignment.
  1695.  
  1696.                 char init1[]="abcdef@xyz@012", *ip=init1;
  1697.                 
  1698.                 while(ip = index(ip, '@'))
  1699.                         *ip = '\0';
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.         The PCCA 8088 Assembler                            Page 21
  1718.  
  1719.  
  1720.         5. The PCCA 8088 Assembler
  1721.  
  1722.         5.1. Introduction
  1723.  
  1724.         PCCA is the 8088/8086 assembler.  It reads assembly language 
  1725.         source files and produces linkable object files.
  1726.  
  1727.         5.2. Invocation
  1728.  
  1729.             PCCA <filename> [ options ]
  1730.  
  1731.         <filename> is the name of the assembly language source file.  If 
  1732.                    it does not include an extension Q the extension '.A' 
  1733.                    is assumed.
  1734.  
  1735.         Options: The case of the option is not significant. Each option 
  1736.         should be separated from other options by blanks.  Options may be 
  1737.         preceded with the dash (-) character.
  1738.  
  1739.         L[ <filename> ] -- The assembler will produce a listing from the 
  1740.                    assembly language input.  This listing includes the 
  1741.                    hex-values generated by the assembler as well as line 
  1742.                    numbers and pagination.  If no name is specified, then 
  1743.                    the name of the source file with the extension '.L' is 
  1744.                    used.  If the specified file does not have an 
  1745.                    extension, '.L' will be used.  Otherwise the listing 
  1746.                    is written to the specified file.  To generate a 
  1747.                    listing on the printer, use '-LPRN:'.
  1748.  
  1749.         O<filename> The assembler will produce an object file with the 
  1750.                    specified name.  If the name lacks an extension, then 
  1751.                    the extension '.O' will be appended to the name.  The 
  1752.                    default object file name is the name of the source 
  1753.                    file with the extension changed to '.O'.
  1754.  
  1755.         T<drive>   The 'T' option specifies the drive where the assembler 
  1756.                    temporary files will be created.  If a RAM Disk is 
  1757.                    available, redirecting temporary files to that drive 
  1758.                    will greatly speed development.  The assembler 
  1759.                    normally creates its temporary files on the default 
  1760.                    drive/directory.
  1761.  
  1762.         Pnn        Specifies page length, in lines.  The default is 66.
  1763.  
  1764.         Wnn        Specifies page width, in characters, for the list 
  1765.                    file. The value nn must be a number from 60 to 132.  
  1766.                    The default is 80.
  1767.  
  1768.         5.3. Example
  1769.  
  1770.  
  1771.         pcca blip
  1772.                    assembles the file named blip.a and produces an object 
  1773.                    file named blip.o.
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.         The PCCA 8088 Assembler                            Page 22
  1784.  
  1785.  
  1786.         M:pcca blip.asm -Ob:blip Lblip.lst
  1787.  
  1788.                    runs the assembler from drive M: on the file named 
  1789.                    blip.asm.  The output is an object file named blip.o 
  1790.                    on drive B: and a listing file named blip.lst on the 
  1791.                    default drive.
  1792.  
  1793.         pcca blip.a TM -oa:blip.o -lb:blip.lst
  1794.  
  1795.                    assembles the file named blip.a.  Temporary files are 
  1796.                    created on drive M:.  The output of the assembler is 
  1797.                    placed on drive A: in the file blip.o.  A listing file 
  1798.                    is generated and written to drive B: in the file 
  1799.                    blip.lst
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.  
  1812.  
  1813.  
  1814.  
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.         The PCCL Object File Linker                        Page 23
  1850.  
  1851.  
  1852.         6. The PCCL Object File Linker
  1853.  
  1854.         6.1. Introduction
  1855.  
  1856.         PCCL is the program that links together object and library  
  1857.         modules and forms an executable program.  For very long command 
  1858.         lines, see the -f option.
  1859.  
  1860.  
  1861.         6.2. Invocation
  1862.  
  1863.                 PCCL <filename> <filename> ...  [options]
  1864.  
  1865.         <filename> A sequence of filenames separated by blanks. The 
  1866.                    filenames should be the names of object (.O) or 
  1867.                    library (.S) files.  If a filename does not have an 
  1868.                    extension, '.O' is assumed.  PCCL automatically looks 
  1869.                    for the supplied library PCCS.S so its name should 
  1870.                    not be included in the list of filenames.
  1871.  
  1872.         Options: All options may be in upper or lower case.  Options must 
  1873.         be separated by  blanks and preceded by a hyphen to differentiate 
  1874.         them from <filename>s.  Note that this is different from other 
  1875.         commands where the hyphen is optional.
  1876.  
  1877.         -A         The assembler option keeps PCCL from generating the C 
  1878.                    initialization code.  Instead, execution begins at the 
  1879.                    beginning of the code rather than starting at the 
  1880.                    main_ public label.  ARGC and ARGV are not calculated 
  1881.                    and the stack is not set up.  Uninitialized variables 
  1882.                    are not filled with zero.  Library functions such as 
  1883.                    creat() and open() cannot be used as they depend on 
  1884.                    the zero initialization.  The 'A' and 'S' options are 
  1885.                    useful for a few cases but caution should be exercised 
  1886.                    in their use.
  1887.  
  1888.         -F<filename> identifies a file containing <filename>s and options 
  1889.                    to be used by PCCL.  This is used for very long lists 
  1890.                    of filenames and options.
  1891.  
  1892.         -L<name>   specifies the drive/directory containing the PCCS.S 
  1893.                    standard library.  If this option is not specified, 
  1894.                    the PCCS.S file must be on the default drive.  With 
  1895.                    MS-DOS 2.0 and later versions of the operating system,  
  1896.                    the PATH system parameter is used to locate the 
  1897.                    library.
  1898.  
  1899.         -Mn        Indicates that the object files following this control 
  1900.                    should be collected in the memory-based overlay 
  1901.                    indicated by the value n ( 1 to 39 ).  See the 
  1902.                    description on overlays below for details on the 
  1903.                    overlay mechanism.
  1904.  
  1905.         -O<filename> changes the name of the output file to 
  1906.                    <filename>.EXE.  If this option is not specified, the 
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.         The PCCL Object File Linker                        Page 24
  1916.  
  1917.  
  1918.                    name of the first object file in the list with the 
  1919.                    .EXE extension will be used.
  1920.  
  1921.         -P[<filename>] Generates a sorted list of publics and offsets.  C 
  1922.                    procedures and data declared outside of procedures are  
  1923.                    automatically public (or extern)  unless explicitly 
  1924.                    declared static.  Publics with names starting with an 
  1925.                    underline '_' are not listed unless the -_ option is 
  1926.                    also specified. The optional name is the destination 
  1927.                    for the publics list.  If omitted, the publics and 
  1928.                    offsets are listed on the console.  The size of 
  1929.                    overlays, if any, will also be displayed.
  1930.  
  1931.         -Shhhh     specifies the stack size.  hhhh is in hex.   Normally, 
  1932.                    PCCL will set the stack size as large as possible.  
  1933.                    The '-S' option can be used to limit this size for use 
  1934.                    with exec().
  1935.          
  1936.         -Vn        This option is used to create disk-based overlays.  
  1937.                    All object files following this option, until the end 
  1938.                    of the list or another overlay option, are collected 
  1939.                    into the overlay indicated by the value n (1 to 39).  
  1940.                    See the overlay section below for details.
  1941.  
  1942.         -_ (underscore) PCCL normally suppresses names that start with an 
  1943.                    underscore (usually internal names) from the publics 
  1944.                    list. The underscore option restores these publics to 
  1945.                    the listing.  This option is useful when you need to 
  1946.                    see all the modules bound to your program.
  1947.  
  1948.  
  1949.         6.3. Examples
  1950.  
  1951.  
  1952.  
  1953.         pccl blip
  1954.                    links the file blip.o with PCCS.S and produces the 
  1955.                    executable file blip.exe.
  1956.  
  1957.         pccl proga progb progc lib.s -p
  1958.  
  1959.                    links the files proga.o, progb.o, and progc.o with the 
  1960.                    user library lib.s  and the standard I/O library, 
  1961.                    PCCS.S, into the application file proga.exe.  The 
  1962.                    map is printed on the screen.
  1963.  
  1964.         pccl proga progb -V1 progc -V2 progd -Pmap -_ -Omyprog
  1965.  
  1966.                    links the files proga.o, progb.o with PCCS.S and 
  1967.                    creates the executable file myprog.exe and the overlay 
  1968.                    file myprog.ov which contains two overlays consisting 
  1969.                    of the object files progc.o and prod.o.  The publics 
  1970.                    map is sent to the file named map and will also list 
  1971.                    the internal names that begin with the underline ('_') 
  1972.                    character.
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.         The PCCL Object File Linker                        Page 25
  1982.  
  1983.  
  1984.         6.4. Space Considerations
  1985.  
  1986.         A program is restricted to a maximum of 64KB of code and 64KB of 
  1987.         data plus the stack.  PCCL calculates the size of code and data 
  1988.         and will report the size of each segment (in hex) when the -P 
  1989.         option is specified.  PCCL cannot calculate the actual stack 
  1990.         requirements.  If the 'stack' and 'locals' size reported by PCCL 
  1991.         seems small, the actual stack requirements should be calculated 
  1992.         by hand to make sure there is enough space.  The actual require-
  1993.         ments are the worst case of four bytes per call plus the size of 
  1994.         locals (including parameters) for all active procedures plus 
  1995.         about 500 bytes for the Operating System calls.  In practice, 2KB 
  1996.         plus the size of the local arrays simultaneously active should be 
  1997.         sufficient.
  1998.  
  1999.         If PCCL reports that the code limit is exceeded, look in the 
  2000.         publics map for the scanf() and printf() routines.  These are 
  2001.         relatively large routines (around 2KB each) and also link in the 
  2002.         floating-point routines.  Eliminating the use of these routines 
  2003.         can result in a large savings.  If scanf() and/or printf() are 
  2004.         necessary but no floating-point values will be used, try using 
  2005.         the PCC7.S instead of the standard PCCS.S library (Rename the 
  2006.         PCCS.S library to something else and rename the PCC7.S library to 
  2007.         PCCS.S).  This will assume the availability of the 8087 math chip 
  2008.         and will not bring in the software floating-point routines.
  2009.  
  2010.  
  2011.         6.5. Overlays
  2012.  
  2013.         Another way to solve the space problem is the use of overlays.  
  2014.         The overlay system provided by this package is very simple.  An 
  2015.         application is divided into a root portion that is always 
  2016.         resident and two or more overlays.  Only one overlay is resident 
  2017.         (executable) at any given time.
  2018.  
  2019.         There are two types of overlays, disk-based overlays and memory-
  2020.         based overlays.  The difference between the two types is the 
  2021.         location of the overlays.  Disk-based overlays, created with the 
  2022.         -V option, are stored in a separate file.  Memory-based overlays, 
  2023.         created with the -M option, are loaded into memory along with the 
  2024.         root code.  Memory-based overlays should only be used when there 
  2025.         is sufficient memory for the root and all of the overlays.  The 
  2026.         advantage of memory-based overlays over disk-based overlays is in 
  2027.         the amount of time needed to make an overlay resident, memory-
  2028.         based overlays being much faster to load.
  2029.  
  2030.         The application program is responsible for initializing the 
  2031.         overlay subsystem and ensuring that the correct overlay is 
  2032.         resident before calling any of the functions in the overlay.
  2033.  
  2034.         For disk-based overlays, the routine overlay_init() must be 
  2035.         called from the root with the name of the overlay file to 
  2036.         initialize the overlay system.  Overlays are loaded by calling 
  2037.         the routine overlay(n) where n is the number of the overlay to be 
  2038.         made resident.
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.         The PCCL Object File Linker                        Page 26
  2048.  
  2049.  
  2050.  
  2051.         For memory-based overlays instead of disk-based overlays, do not 
  2052.         call the overlay_init() routine and call the routine moverlay() 
  2053.         in place of the routine overlay().
  2054.  
  2055.         In the following example the root is composed of the file X.C.  
  2056.         The first overlay is the file Y.C and the second overlay is in 
  2057.         the file Z.C.
  2058.  
  2059.  
  2060.         File X.C:
  2061.                 main() {
  2062.                         overlay_init("X.OV"); /* initialize */
  2063.                         puts("this is the root program\n");
  2064.                         overlay(1); /* make 1st overlay resident */
  2065.                         zip();    /* call into 1st overlay */
  2066.                         overlay(2); /* make the second resident */
  2067.                         zap();    /* call into second overlay */
  2068.                         puts("bye\n");
  2069.                         }
  2070.  
  2071.         File Y.C:
  2072.                 zip() {
  2073.                         puts("  this is ZIP  ");
  2074.                         }
  2075.  
  2076.         File Z.C:
  2077.                 zap() {
  2078.                         puts("  this is ZAP  ");
  2079.                         }
  2080.  
  2081.  
  2082.         The files are compiled in the usual fashion:
  2083.  
  2084.                 PCC x
  2085.                 PCC y
  2086.                 PCC z
  2087.  
  2088.         Ordinarily, the files would be linked together using the command:
  2089.  
  2090.                 pccl x y z
  2091.  
  2092.         Instead, to create the two overlays, the command:
  2093.  
  2094.                 pccl x -V1 y -V2 z
  2095.          
  2096.         is used.  The -V option is followed by the overlay number.  This 
  2097.         number starts at 1 and runs in ascending order up to 39.  All 
  2098.         files following the -V or the -M option are included in the 
  2099.         overlay.  All library modules (from .S files) are included in the 
  2100.         root.  The result from the execution of the PCCL program with the 
  2101.         -V option is the executable root (.EXE) file and the overlay 
  2102.         (.OV) file which contains the overlays.  The result with the -M 
  2103.         option is an .EXE file containing both the root and the overlays.
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.         The PCCL Object File Linker                        Page 27
  2114.  
  2115.  
  2116.         The -P option of PCCL will also display the size of each overlay 
  2117.         as well as the overlay for each symbol.
  2118.  
  2119.  
  2120.         6.6. Libraries
  2121.  
  2122.         Libraries are just concatenated .O files. The .S extension tells 
  2123.         PCCL to only include modules that are referenced. If all of the 
  2124.         routines in a library are required, rename the .S file to a .O 
  2125.         file to force all of the modules in the library to be included.
  2126.  
  2127.         PCCL includes the entire .O module  from a library if any of its 
  2128.         public names have been selected by other object modules processed 
  2129.         by PCCL.  Thus, if a .O file contains several functions, all of 
  2130.         them will be bound into a program if any of them are called.
  2131.  
  2132.         PCCL searches a library once.  Thus if you have two modules, A 
  2133.         and B, and A calls B , the B must follow A in the library.  LIB88 
  2134.         attempts to order the library so that these inter-library 
  2135.         references are ordered so that PCCL will find them.  One way 
  2136.         around any circular dependencies (e.g., B  also calls A ) is to 
  2137.         include the library twice on the command line.
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.         The PCCS.S Standard Library                       Page 28
  2180.  
  2181.  
  2182.         7. The PCCS.S Standard Library
  2183.  
  2184.         7.1. Introduction
  2185.  
  2186.         This section describes the standard library, PCCS.S, for the 
  2187.         PCC C compiler and PCCA assembler.  This library includes 
  2188.         routines similar to routines available in UNIX with some 
  2189.         inevitable differences due to the MS-DOS Operating System.  
  2190.  
  2191.         All of the routines are in the PCCS.S library file provided on 
  2192.         the distribution disk.  This file must be on the default 
  2193.         drive/directory, in a directory listed in the PATH system 
  2194.         parameter,  or on the drive/directory referred to by the '-L' 
  2195.         option for PCCL to execute correctly.
  2196.  
  2197.         There is a PCC7.S library that has the same functions as the 
  2198.         PCCS.S libarary but assumes the availability of the 8087 math 
  2199.         chip to perform the floating-point operations.  To use the 8087, 
  2200.         rename PCC7.S to PCCS.S.
  2201.  
  2202.         7.2. Names
  2203.  
  2204.         Public names starting with the underline character ('_') are  
  2205.         reserved for PCC internal routines and should be avoided.  Names 
  2206.         of this form are also employed for user callable routines such as 
  2207.         _move() whose names might conflict with user names.
  2208.  
  2209.         PCC automatically appends the underline character ('_') to the 
  2210.         end of public names to avoid conflicts with assembly language 
  2211.         reserved words.  PCCA does not do this so the underline must be 
  2212.         manually appended to publics used to link with code generated by 
  2213.         PCC.  For example, the C puts() routine should be referred to as 
  2214.         puts_ from assembler.   PCCL ignores the case of publics, unlike 
  2215.         UNIX, so  puts_ matches the name PutS_.
  2216.  
  2217.         7.3. Program Initialization
  2218.  
  2219.         PCCL inserts a jmp _csetup as the first executable instruction in 
  2220.         the program.  _CSETUP performs the following initialization 
  2221.         functions:
  2222.  
  2223.         1. sets the data/stack segment size to the lower of: available 
  2224.            memory, 64K, or the size of the static data area plus the PCCL 
  2225.            -S option,
  2226.         2. Formats argc and argv[] from the Program Segment Prefix,
  2227.         3. Zeros the Uninitialized Data Area, and
  2228.         4. Calls main(argc, argv)
  2229.  
  2230.         Assembly language main programs that require normal 
  2231.         initialization should contain the following
  2232.  
  2233.                 PUBLIC MAIN_
  2234.                 MAIN_:
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.         The PCCS.S Standard Library                       Page 29
  2246.  
  2247.  
  2248.         The initialization code will set the SS, DS and SP registers so 
  2249.         that there is the largest possible stack unless the PCCL '-S' 
  2250.         option is used to restrict the stack size.  The stack grows 
  2251.         towards the unitialized data area.  The figure below shows the 
  2252.         memory layout after the initialization code has run:
  2253.  
  2254.              +-------------------+
  2255.              |     Stack         |
  2256.              +-------------------+<- SP,BP
  2257.              |                   |
  2258.              /     Heap          /
  2259.              +-------------------+<- _memory()
  2260.              |    Un-Init Data   |
  2261.              +-------------------+
  2262.              |    Init Data      |
  2263.              +-------------------+<- DS,SS
  2264.              |    Code           |
  2265.              +-------------------+<- CS
  2266.              |    PSP            |
  2267.              +-------------------+
  2268.  
  2269.         Fig. 7-1: Initial Memory Layout
  2270.  
  2271.         The memory between the end of the uninitialized area and the 
  2272.         stack is not normally used by PCC or the program (unless the 
  2273.         program needs an inordinate amount of stack).  This area is 
  2274.         considered to be free memory.  This memory area can be accessed 
  2275.         directly by using the _memory() and _showsp() routines to 
  2276.         calculate its extent.  Another way to access this memory is to 
  2277.         use the malloc() routine.  Do not use both methods.  Remember to 
  2278.         leave enough space for the stack to grow.
  2279.  
  2280.         The -A option of PCCL inhibits the call to _csetup.  Execution 
  2281.         commences with the first instruction of the first filename 
  2282.         specified to PCCL.  On entry, the registers have the following 
  2283.         values:
  2284.  
  2285.         CS      Address of Code Segment.  Execution starts at CS:0.
  2286.         SS      Address of Data Segment.
  2287.         ES,DS   Address of Program Segment Prefix
  2288.         SP      Stack size set by PCCL
  2289.  
  2290.         The source code for _csetup is in the file ISETUP.A. 
  2291.  
  2292.         7.4. Calling Conventions
  2293.  
  2294.         Arguments to a function are pushed on the stack, rightmost 
  2295.         argument first.  It is the responsibility of the calling function 
  2296.         to clean up the stack.  For example
  2297.  
  2298.                 int i;
  2299.  
  2300.                 zip(i, 6);
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.         The PCCS.S Standard Library                       Page 30
  2312.  
  2313.  
  2314.         would generate the following code
  2315.  
  2316.                 mov     ax,6
  2317.                 push    ax
  2318.                 push    word i_
  2319.                 public zip_
  2320.                 call    zip_
  2321.                 add     sp,4
  2322.  
  2323.         The word modifier is required because PCC allocates two bytes for 
  2324.         ints.  The add sp,4 removes the two words that were pushed as 
  2325.         parameters to zip_.  Note the PCC appended '_' on names.  If 
  2326.         there had been no local variables defined in the function, the 
  2327.         clean-up code would have been
  2328.  
  2329.                 mov     sp,bp
  2330.  
  2331.         which is faster.
  2332.  
  2333.         Data is pushed on the stack as follows:
  2334.  
  2335.                 
  2336.         char       pushed as a word, with high-order byte set to zero
  2337.  
  2338.                         mov  AL,data_
  2339.                         mov  AH,0
  2340.                         push AX
  2341.  
  2342.         int        pushed as a word
  2343.         unsigned
  2344.                         push WORD data_
  2345.  
  2346.         long       pushed with least-significant word pushed last
  2347.  
  2348.                         push WORD data_[2]
  2349.                         push WORD data_[0]
  2350.  
  2351.         float      Changed  to  double and pushed with  least-significant 
  2352.                    word pushed last
  2353.  
  2354.                         mov  si,offset data_
  2355.                         PUBLIC _FLOADE  ; load float
  2356.                         call _FLOADE
  2357.                         PUBLIC _FPUSH   ; push double
  2358.                         call _FPUSH
  2359.  
  2360.         double     pushed with least-significant word pushed last
  2361.  
  2362.                         push WORD data_[6]
  2363.                         push WORD data_[4]
  2364.                         push WORD data_[2]
  2365.                         push WORD data_[0]
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.         The PCCS.S Standard Library                       Page 31
  2378.  
  2379.  
  2380.         struct     push  (sizeof(struct)  + 1) >> 1  words,  with  least-
  2381.                    significant word pushed last.
  2382.  
  2383.                         mov  cx,nn    ; size in words
  2384.                         sub  sp,cx    ; make room on stack
  2385.                         mov  di,sp    ; target
  2386.                         mov  si,offset data_  ; source
  2387.                         mov  ax,ds    ; setup
  2388.                         mov  es,ax    ;    es
  2389.                         cld           ; set direction up
  2390.                 rep     movsw         ; copy to stack
  2391.  
  2392.  
  2393.         7.5. LIBRARY CONVENTIONS
  2394.  
  2395.         Called functions are responsible for preserving CS, DS, SS, SP, 
  2396.         and BP across the function call.  All other registers need not be 
  2397.         maintained.  The usual preamble for a called function is
  2398.  
  2399.                         PUBLIC fname_
  2400.                 fname_:
  2401.                         push bp      ; save old frame pointer
  2402.                         mov  bp,sp   ; establish local frame
  2403.  
  2404.         For functions that don't return structures, parameters begin in 
  2405.         the local frame at [bp+4], and continue upward based on the size 
  2406.         of each parameter.  Thus  for the fragment
  2407.  
  2408.                 blip(x, y, z)
  2409.                 int x;
  2410.                 long y;
  2411.                 double z;
  2412.  
  2413.         the parameters would be referenced in Assembler as
  2414.  
  2415.                 mov  cx,WORD [bp+4]  ; x_
  2416.                 mov     ax,WORD [bp+6]  ; lsw of y_
  2417.                 mov  dx,WORD [bp+8]  ; msw of y_
  2418.                 lea  si,[bp+10]      ; addr of z_
  2419.  
  2420.         For functions that do return structures, [bp+4] contains a 
  2421.         pointer to where the structure should be returned.  So if the 
  2422.         above fragment was
  2423.  
  2424.                 struct foo blip(x, y, z)
  2425.  
  2426.         the parameters would be
  2427.  
  2428.                 mov  cx,WORD [bp+06]  ; x_
  2429.                 mov     ax,WORD [bp+08]  ; lsw of y_
  2430.                 mov  dx,WORD [bp+10]  ; msw of y_
  2431.                 lea  si,[bp+12]       ; addr of z_
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.         The PCCS.S Standard Library                       Page 32
  2444.  
  2445.  
  2446.         Local variables are allocated below the current frame pointer, 
  2447.         regardless of what the function returns, so that the fragment
  2448.  
  2449.                 {
  2450.                 int aa[2];
  2451.                 long b;
  2452.  
  2453.         would be referenced as
  2454.  
  2455.                 sub  sp,8       ; allocate space for locals
  2456.                 mov  ax,[bp-4]  ; aa_[1]
  2457.                 mov     dx,[bp-8]  ; msw b_
  2458.  
  2459.         The standard exit sequence is
  2460.  
  2461.                 mov     sp,bp   ; reclaim any local space
  2462.                 pop     bp      ; old frame pointer
  2463.                 ret          ; caller will clean up stack
  2464.  
  2465.         Values  are  returned from functions as followings:
  2466.  
  2467.              char      returned  in AX.   char values are returned in  AL 
  2468.                        with AH
  2469.              int       set to zero
  2470.              unsigned
  2471.  
  2472.              long      returned in DX:AX.  (AX contains lsw)
  2473.  
  2474.              double    returned on floating point stack (s/w or 8087). 
  2475.              float
  2476.  
  2477.              struct    returned to address in [bp+4]
  2478.  
  2479.         7.6. Disk Input/Output Routines
  2480.  
  2481.         In this implementation of C I/O, procedures like getc() are 
  2482.         functions rather than macros and a file identifier FILE is simply  
  2483.         an integer containing the file number rather than a pointer to a 
  2484.         structure.  This change means that read() and getc() calls may be 
  2485.         intermingled and there is little difference between open() and 
  2486.         fopen() on a file.
  2487.  
  2488.         In UNIX there is a distinction between file and stream I/O.  
  2489.         Crudely stated, the functions that have 'f' as their first letter  
  2490.         (fopen(), fread() etc.) deal with streams, and other primitives 
  2491.         (open(),  read() etc.) access files.  These two forms of I/O are 
  2492.         compatible -- fopen() may be used to open a file a file and then 
  2493.         read() used to read it -- but it is best to use either the stream 
  2494.         or file primitives only for a particular file for portability.  
  2495.         The FILE type is defined in the stdio.h include file and is 
  2496.         simply an int type.  This int contains the file number, the same 
  2497.         number returned by open() and creat().  To use the stream 
  2498.         routines with a file opened with the open(), merely pass the file 
  2499.         number. 
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.         The PCCS.S Standard Library                       Page 33
  2510.  
  2511.  
  2512.         The stream style of I/O primitives are: fopen() to open a file, 
  2513.         fread(), fgets() or fgetc() [getc()] to read,  fwrite(), fputs() 
  2514.         or fputc() [putc()] to write, fseek() to seek, fflush() to write 
  2515.         out internal buffers, and fclose() to close.
  2516.  
  2517.         The file type I/O primitives are: open(), creat(), read(),  
  2518.         write(), lseek(), and close().
  2519.  
  2520.         The maximum number of files that can be open at one time is 
  2521.         either 20, or the number specified in CONFIG.SYS, whichever is 
  2522.         less. See section 2.3 for details about CONFIG.SYS.  New files 
  2523.         are creat()'d and old files are open()'d.
  2524.  
  2525.         A closed file may be rename()'d or unlink()'d (deleted).
  2526.  
  2527.         Three predefined file numbers may be used to read from or write 
  2528.         to the console.  To use them, include the following defines in 
  2529.         the program:
  2530.  
  2531.           #define stdin   0
  2532.           #define stdout  1
  2533.           #define stderr  2
  2534.  
  2535.  
  2536.         7.7. Math Routines
  2537.  
  2538.         If any of the transcendental or sqrt() functions are used, 
  2539.         include the file math.h or the equivalent declarations to specify 
  2540.         them as returning double's.
  2541.  
  2542.         math.h includes the statement 
  2543.  
  2544.                 extern int errno;
  2545.  
  2546.         errno is set to a non-zero value: on floating point stack errors,  
  2547.         if an argument to a math routine is out of range, or if the 
  2548.         result of a math routine would under/overflow.  Error codes and 
  2549.         names (defined in math.h) are:
  2550.  
  2551.         30 ESTK   F/P stack overflow.  The most probable cause is calling 
  2552.                   a function that returns a double without declaring it 
  2553.                   as such to the compiler.  After eight calls, the f/p 
  2554.                   stack will be full.
  2555.  
  2556.         33 EDOM   invalid argument, i.e., sqrt(-1.0).
  2557.  
  2558.         34 ERANGE invalid arg size, i.e., asin(2.0).
  2559.  
  2560.         The function  rerrno() is called by the floating point routines 
  2561.         whenever an error is detected.  rerrno() prints out an 
  2562.         appropriate error message and calls exit().  In order to bypass 
  2563.         this effect, install the following function in your program
  2564.  
  2565.                 rerrno() {;}  /* null function to suppress printing */
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.         The PCCS.S Standard Library                       Page 34
  2576.  
  2577.  
  2578.         7.8. IBM-PC Screen and Keyboard Interface
  2579.  
  2580.         A number of functions have been written to simplify the interface 
  2581.         between C programs and the IBM-PC and its clones.  These routines 
  2582.         are not in the standard PCCS.S library but are distributed in 
  2583.         source form in the file PCIO.A.  To use these routines, they must 
  2584.         be assembled and bound in.  For example:
  2585.  
  2586.                 A>asm88 b:pcio
  2587.                 A>bind b:blip b:pcio
  2588.  
  2589.         See the comments in the IBM Technical Reference Manual for 
  2590.         details on the BIOS interface used by PCIO.
  2591.  
  2592.  
  2593.         7.9. Standard Library Functions
  2594.  
  2595.  
  2596.         7.9.1. abs()
  2597.  
  2598.                   unsigned uval;
  2599.                   int y;
  2600.  
  2601.                   uval = abs(y);
  2602.  
  2603.         abs returns |y| (absolute value).
  2604.  
  2605.  
  2606.         7.9.2. atoi()
  2607.  
  2608.                   char *cp;
  2609.                   int ival;
  2610.  
  2611.                   ival = atoi(cp);
  2612.                 
  2613.         atoi converts the char array at cp to its corresponding int 
  2614.         value.  The first unrecognized character terminates the 
  2615.         conversion.
  2616.  
  2617.         WS is either a tab or a space.  A digit is an ASCII character '0' 
  2618.         through '9'.  [] delimit sequences that can occur zero or one 
  2619.         time.  {} delimit sequences that can occur zero or many times.
  2620.  
  2621.                 Valid character Sequences
  2622.  
  2623.                 {WS} [-] {DIGIT}
  2624.          
  2625.  
  2626.         SEE ALSO:scanf()
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.         The PCCS.S Standard Library                       Page 35
  2642.  
  2643.  
  2644.         NOTES: To guard against int overflow, or large unsigned values 
  2645.         being stored as negative integers, use atol and check that the 
  2646.         high-order word is the same as the high-order bit of the low-
  2647.         order word.
  2648.  
  2649.                 atoi(str)
  2650.                 char *str; {
  2651.                         long val, atol();
  2652.                         int sign, extn;
  2653.  
  2654.                         extn = (val = atol(str)) >> 16;
  2655.                         sign = val & 0x8000;
  2656.                         if((!sign && extn != 0) || (sign && extn != -1))
  2657.                                 overflowErr();
  2658.                         return val;
  2659.                         }
  2660.  
  2661.  
  2662.         7.9.3. atof()
  2663.  
  2664.                   char *cp;
  2665.                   double dval;
  2666.  
  2667.                   dval = atof(cp);
  2668.                 
  2669.         atof converts the char array at cp to its corresponding double 
  2670.         value.  The first unrecognized character terminates the 
  2671.         conversion.
  2672.  
  2673.         WS is either a tab or a space.  A digit is an ASCII character '0' 
  2674.         through '9'.  E is either an ASCII 'E' or 'e'.  [] delimit 
  2675.         sequences that can occur zero or one time.  {} delimit sequences 
  2676.         that can occur zero or many times.
  2677.  
  2678.                 Valid character Sequences
  2679.  
  2680.                 {WS} [-] {digit} ['.'] [{digit} [E [-] {digit}]]
  2681.          
  2682.         SEE ALSO:scanf()
  2683.  
  2684.  
  2685.         7.9.4. atol()
  2686.  
  2687.                   char *cp;
  2688.                   long lval, atol();
  2689.  
  2690.                   lval = atol(cp);
  2691.                 
  2692.         atol converts the char array at cp to its corresponding long 
  2693.         value.  The first unrecognized character terminates the 
  2694.         conversion.
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.         The PCCS.S Standard Library                       Page 36
  2708.  
  2709.  
  2710.         WS is either a tab or a space.  A digit is an ASCII character '0' 
  2711.         through '9'.  [] delimit sequences that can occur zero or one 
  2712.         time.  {} delimit sequences that can occur zero or many times.
  2713.  
  2714.                 Valid character Sequences
  2715.  
  2716.                 {WS} [-] {DIGIT}
  2717.          
  2718.  
  2719.         SEE ALSO:scanf()
  2720.  
  2721.                         }
  2722.  
  2723.  
  2724.         7.9.5. ceil()
  2725.  
  2726.                   #include <math.h>
  2727.  
  2728.                   double dval, x;
  2729.  
  2730.                   dval = ceil(x);
  2731.  
  2732.         ceil returns the smallest integer value not less than x.
  2733.  
  2734.  
  2735.         7.9.6. chain()
  2736.  
  2737.                   char *filename, *commandTail;
  2738.  
  2739.                   chain(filename, commandTail)
  2740.  
  2741.         chain will load and execute an arbitrary program Q filename is 
  2742.         the complete pathname of the program (including the .EXE or .COM 
  2743.         suffix).  commandTail  contains the arguments to the program.  
  2744.  
  2745.         chain functions like exec  except that control is not returned to 
  2746.         the calling program.  chain is in the file EXEC.O, in the 
  2747.         distribution. It should be bound in first to save memory since it 
  2748.         loads the called program immediately behind itself.  For example:
  2749.  
  2750.                 A>PCCL EXEC BLIP -OBLIP
  2751.  
  2752.         NOTE: To invoke a Batch file, or a DOS built-in command, use 
  2753.         COMMAND.COM with the '/c' switch as follows.
  2754.  
  2755.                 chain("\\command.com", "/cxxx");
  2756.  
  2757.         Where xxx is one of the DOS built-in commands ( 'dir', 'copy', 
  2758.         Remember that two backslashes are required to insert a single 
  2759.         backslash in a string.  Invoking COMMAND.COM with no parameters 
  2760.         will start another DOS shell.  To return type
  2761.  
  2762.                 exit
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.         The PCCS.S Standard Library                       Page 37
  2774.  
  2775.  
  2776.         7.9.7. close()
  2777.  
  2778.                   int handle, stat;
  2779.  
  2780.                   stat = close(handle);
  2781.  
  2782.         close writes any buffered data for the file fp to that file, and 
  2783.         closes the file. Returns -1 if fp is not open, or if an error 
  2784.         occurred writing the buffered data to that file.
  2785.                 
  2786.  
  2787.         7.9.8. creat()
  2788.  
  2789.                   int handle;
  2790.                   char *name;
  2791.  
  2792.                   handle = creat(name)
  2793.  
  2794.         creat creates the file name  and return an int that is used to 
  2795.         reference it in future file operations, or -1 if the file can't 
  2796.         be opened.  If the file name already exists, it is deleted before 
  2797.         it is opened. 
  2798.  
  2799.         NOTES: creat  opens a file in update mode so that after a file is 
  2800.         written,  a program can seek to the begining of the file and read 
  2801.         it without closing the file and reopening it.
  2802.  
  2803.         Any  of  the  functions can open the console ("CON")  or  printer 
  2804.         ("PRN").
  2805.  
  2806.  
  2807.         7.9.9. dates()
  2808.  
  2809.                   char *buf;
  2810.                 
  2811.                   dates(buf);
  2812.  
  2813.         dates formats the string buf with the current date as "mm/dd/yy".
  2814.  
  2815.  
  2816.         7.9.10. doint()
  2817.  
  2818.                   char inum;
  2819.                 
  2820.                   extern unsigned _rax, _rbx, _rcx, _rdx, _rsi, _rdi,
  2821.                                   _res, _rds;
  2822.                   extern char _carryf, _zerof;
  2823.  
  2824.                   _doint(inum);
  2825.  
  2826.         _rax - _rds contain the values of the corresponding 8088 internal 
  2827.         registers that are loaded and saved by _doint .  _carryf is the 
  2828.         carry flag; _zerof is the zero flag
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.         The PCCS.S Standard Library                       Page 38
  2840.  
  2841.  
  2842.         _doint will cause a software interrupt and may be used to call 
  2843.         whatever routines are available in the particular machine.  If 
  2844.         _rds is set to -1, the current value of the DS register is used.
  2845.  
  2846.         NOTE:  The following example, on an IBM-PC, would use interrupt 
  2847.         10H to print the string.
  2848.  
  2849.                 extern unsigned _rax, _rbx, _rds;
  2850.                 extern char _carryf;
  2851.                 char str[] = "Hello There!!";
  2852.                 int i;
  2853.  
  2854.                 for (i = 0; i < sizeof(str); i++) {
  2855.                         _rax = (14 << 8) + str[i];
  2856.                         _rbx = 0;
  2857.                         _rds = -1;
  2858.                         _doint(0x10);
  2859.                         }
  2860.  
  2861.  
  2862.         7.9.11. exec()
  2863.  
  2864.                   char *filename, *commandTail, Code;
  2865.  
  2866.                   Code = exec(filename, commandTail)
  2867.  
  2868.         exec will load and execute an arbitrary program.  Filename is the 
  2869.         complete pathname of the program (including the .EXE or .COM 
  2870.         suffix).  commandTail  contains the arguments to the program.  
  2871.         exec will return the completion code from the program or -1 if an 
  2872.         error occurred loading the program.  exec is in the EXEC.O file 
  2873.         provided in the distribution.
  2874.  
  2875.         NOTE: Completion codes are set for programs running under MS-DOS 
  2876.         2.0 or later versions of the operating system.  If a program 
  2877.         exits with
  2878.  
  2879.                 exit(n);
  2880.  
  2881.         the system ERRORLEVEL will be set to n.  A program that returns 
  2882.         from the main function other than by exit()sets ERRORLEVEL to 
  2883.         zero.  ERRORLEVEL can be tested with the DOS batch file IF 
  2884.         command.  See the section under 'BATCH' in the IBM 2.xx DOS 
  2885.         manual for details on the IF command.
  2886.  
  2887.         To invoke a Batch file, or a DOS built-in command, use 
  2888.         COMMAND.COM with the '/c' switch as follows.
  2889.  
  2890.                 exec("\\command.com", "/cxxx");
  2891.  
  2892.         Where xxx is one of the DOS built-in commands ( 'dir', 'copy', 
  2893.         Remember that two backslashes are required to insert a single 
  2894.         backslash in a string.  Invoking COMMAND.COM with no parameters 
  2895.         will start another DOS shell.  To return type
  2896.                 exit
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.         The PCCS.S Standard Library                       Page 39
  2906.  
  2907.  
  2908.  
  2909.         PCC normally allocates a stack as large as possible.  This is not 
  2910.         desirable when using exec , as little memory may be left for the 
  2911.         second program.  The -Shhhh option of the PCCL program should be 
  2912.         used to reduce the size of the stack and consequently the size of 
  2913.         the program.  Remember that the hhhh value of the option is in 
  2914.         hex and that it must be large enough for all parameters and 
  2915.         locals active at one time.  An extra 0x100 (256) bytes should 
  2916.         also be added for any system calls.
  2917.  
  2918.  
  2919.         7.9.12. exit()
  2920.  
  2921.                   char Code;
  2922.  
  2923.                   exit(Code)
  2924.  
  2925.         exit terminates the program with completion code Code.  A main() 
  2926.         procedure can also exit  with a completion code of zero by 
  2927.         returning or by "falling" through the end of the procedure.
  2928.  
  2929.         NOTE: Completion codes are set for programs running under MS-DOS 
  2930.         2.0 or later versions of the operating system.  If a program 
  2931.         exits with
  2932.  
  2933.                 exit(n);
  2934.  
  2935.         the system ERRORLEVEL will be set to n.  A program that returns 
  2936.         from the main function other than by exit()sets ERRORLEVEL to 
  2937.         zero.  ERRORLEVEL can be tested with the DOS batch file IF 
  2938.         command.  See the section under 'BATCH' in the IBM 2.xx DOS 
  2939.         manual for details on the IF command.
  2940.  
  2941.  
  2942.         7.9.13. exp()
  2943.  
  2944.                   #include <math.h>
  2945.  
  2946.                   double x, dval, exp(), exp10();
  2947.  
  2948.                   dval = exp(x);
  2949.                   dval = exp10(x);
  2950.  
  2951.         exp returns the exponential function of x; exp10 returns the 
  2952.         base 10 exponent.
  2953.  
  2954.         NOTE: exp returns a very large value when the result would 
  2955.         overflow; errno is set to ERANGE.  ERANGE is defined in math.h.
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.         The PCCS.S Standard Library                       Page 40
  2972.  
  2973.  
  2974.         7.9.14. fabs()
  2975.  
  2976.                   #include <math.h>
  2977.  
  2978.                   double dval, x;
  2979.  
  2980.                   dval = fabs(x);
  2981.  
  2982.         fabs returns |x| (absolute value).
  2983.  
  2984.  
  2985.         7.9.15. fclose()
  2986.  
  2987.                   #include <stdio.h>
  2988.                   FILE *fp;
  2989.                   int stat;
  2990.  
  2991.                   stat = fclose(fp);
  2992.  
  2993.         fclose writes any buffered data for the file fp to that file, and 
  2994.         closes the file. Returns -1 if fp is not open, or if an error 
  2995.         occurred writing the buffered data to that file.
  2996.                 
  2997.  
  2998.         7.9.16. fgetc()
  2999.  
  3000.                   #include <stdio.h>
  3001.                   FILE *fp;
  3002.                   int data;
  3003.  
  3004.                   data = fgetc(fp)
  3005.  
  3006.         fgetc returns the next character from the file fp, or -1 if an 
  3007.         error, or end of file was sensed.
  3008.  
  3009.         SEE ALSO: scanf(), fread()
  3010.  
  3011.  
  3012.         7.9.17. fgets()
  3013.  
  3014.                   #include <stdio.h>
  3015.                   FILE *fp;
  3016.                   char *cp, buf[], *fgets();
  3017.                   int len;
  3018.  
  3019.                   cp  = fgets(buf, len, fp);
  3020.  
  3021.         fgets reads the next line, but not more than len - 1 characters 
  3022.         from the file fp into buf.  The last character read into buf is 
  3023.         followed by a zero.  fgets returns buf, or 0 on end of file or an 
  3024.         error.
  3025.  
  3026.         SEE ALSO: fscanf(), fread()
  3027.  
  3028.         NOTE:  fgets returns the CR character.
  3029.  
  3030.  
  3031.  
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.         The PCCS.S Standard Library                       Page 41
  3038.  
  3039.  
  3040.         7.9.18. floor()
  3041.  
  3042.                   #include <math.h>
  3043.  
  3044.                   double dval, x;
  3045.  
  3046.                   dval = floor(x);
  3047.  
  3048.         floor returns the largest integer value not greater than x.
  3049.  
  3050.  
  3051.         7.9.19. fopen()
  3052.  
  3053.                   #include <stdio.h>
  3054.                   FILE *fp;
  3055.                   char *name, *method;
  3056.  
  3057.                   fp = fopen(name, method)
  3058.  
  3059.         fopen opens the file name and returns an FILE pointer that 
  3060.         identifies the file in future file operations.  Returns NULL 
  3061.         if the file can't be opened.
  3062.  
  3063.         method is a char string having one of the following values: "r" = 
  3064.         open for reading,"w" = open for writing, "a" = open for append -- 
  3065.         open for writing at end of file, or create for writing.
  3066.  
  3067.         NOTES: fopen for read access is the same as open for update; 
  3068.         write access is the same as creat for the file; append causes a 
  3069.         seek to the end of an existing file, or the creation of a new 
  3070.         file as required. 
  3071.  
  3072.         Any  of  the  functions can open the console ("CON")  or  printer 
  3073.         ("PRN").
  3074.  
  3075.  
  3076.         7.9.20. fputc()
  3077.  
  3078.                   #include <stdio.h>
  3079.                   FILE *fp;
  3080.                   char ch;
  3081.                   int data;
  3082.  
  3083.                   data = fputc(ch, fp);
  3084.  
  3085.         fputc writes ch to the file fp.  fp must have been opened 
  3086.         prior to the call.  The functions return ch, or -1 on error.
  3087.  
  3088.         SEE ALSO: printf(), fwrite()
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.         The PCCS.S Standard Library                       Page 42
  3104.  
  3105.  
  3106.         7.9.21. fputs()
  3107.  
  3108.                   #include <stdio.h>
  3109.                   FILE *fp;
  3110.                   char buf[];
  3111.                   int err;
  3112.  
  3113.                   err = fputs(buf, fp);
  3114.  
  3115.         fputs copies the null terminated string buf to the file fp.  
  3116.         fputs returns a -1 on error.
  3117.  
  3118.         SEE ALSO: fprintf()
  3119.  
  3120.         NOTE: On output, linefeed ('\n') is converted to carriage return 
  3121.         - linefeed ('\r\n').
  3122.  
  3123.  
  3124.         7.9.22. frand()
  3125.  
  3126.                   double dval;
  3127.  
  3128.                   dval = frand();
  3129.  
  3130.         frand returns the next pseudo-random number in the range from 
  3131.         0.0 to 1.0.
  3132.  
  3133.  
  3134.         7.9.23. fscanf()
  3135.  
  3136.                   #include <stdio.h>
  3137.                   FILE *fp;
  3138.                   char fcs[];
  3139.                   int num;
  3140.  
  3141.                   num = fscanf(fp, fcs [, ptr ] ... );
  3142.  
  3143.         fscanf reads from the file fp.
  3144.  
  3145.         Returns the number of items successfully scanned or -1 on end of 
  3146.         input or error.
  3147.  
  3148.         See scanf() for a how it works.
  3149.  
  3150.  
  3151.         7.9.24. getc()
  3152.  
  3153.                   #include <stdio.h>
  3154.                   FILE *fp;
  3155.                   int data;
  3156.  
  3157.                   data = getc(fp)
  3158.  
  3159.         getc  return the next character from the file fp, or -1 if an 
  3160.         error, or end of file was sensed.
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.         The PCCS.S Standard Library                       Page 43
  3170.  
  3171.  
  3172.  
  3173.         NOTE: getc is a function rather than the usual macro.
  3174.  
  3175.         getchar() will hangup reading redirected input under DOS 2.X and 
  3176.         higher.  Use getc(stdin) if the input could be redirected.
  3177.  
  3178.         SEE ALSO: scanf(), fread()
  3179.  
  3180.  
  3181.         7.9.25. getchar()
  3182.  
  3183.  
  3184.                   int data;
  3185.  
  3186.                   data = getchar();
  3187.  
  3188.         getchar  returns the next character from stdin, or -1 if an 
  3189.         error, end of file, or a CTRL-Z was found.
  3190.  
  3191.         NOTE: getchar is a function rather than the usual macro.
  3192.  
  3193.         getchar() will hangup reading redirected input under DOS 2.X and 
  3194.         higher.  Use getc(stdin) if the input could be redirected.
  3195.  
  3196.         SEE ALSO: scanf(), fread()
  3197.  
  3198.  
  3199.         7.9.26. gets()
  3200.  
  3201.                   char *cp, buf[], *gets();
  3202.                   int len, size;
  3203.  
  3204.                   cp  =  gets(buf);
  3205.                   len = _gets(buf, size);
  3206.  
  3207.         gets obtains a line-edited string from the console (stdin) into 
  3208.         buf.  During input, <ESC> means backup and start over, 
  3209.         <BACKSPACE> means delete the previous character and <RETURN> 
  3210.         means end of string.  <RETURN> is replaced in buf by a zero.  
  3211.         gets returns its argument, or 0 on end of file or an error.
  3212.  
  3213.         _gets obtains not more than size - 1 characters from the console 
  3214.         into buf.  Editing proceeds as with gets.  _gets returns the 
  3215.         number of characters obtained, or 0 on end of file or an error.
  3216.  
  3217.         SEE ALSO: fscanf(), fread()
  3218.  
  3219.         NOTE: gets and _gets don't return the CR character
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.         The PCCS.S Standard Library                       Page 44
  3236.  
  3237.  
  3238.         7.9.27. getw()
  3239.  
  3240.                   #include <stdio.h>
  3241.                   FILE *fp;
  3242.                   int data;
  3243.  
  3244.                   data = getw(fp)
  3245.  
  3246.         getw returns the next int from the file fp, or -1 if an error, or 
  3247.         end of file was sensed.
  3248.  
  3249.         SEE ALSO: scanf(), fread()
  3250.  
  3251.  
  3252.         7.9.28. in()
  3253.  
  3254.                   char ch;
  3255.                   unsigned port, wd;
  3256.  
  3257.                   ch = _inb(port);
  3258.                   wd = _inw(port);
  3259.  
  3260.         _inb  and _inw  read the byte ch  and word wd, respectively, from 
  3261.         the indicated port.
  3262.  
  3263.  
  3264.         7.9.29. index()
  3265.  
  3266.                   char *cp, *src, ch;
  3267.  
  3268.                   cp = index(src, ch);
  3269.  
  3270.         index works on null-terminated strings.  There is no test for 
  3271.         overflow.
  3272.  
  3273.         index returns a pointer to the first occurance of ch in src, 
  3274.         or 0 if ch doesn't occur.
  3275.  
  3276.  
  3277.         7.9.30. log()
  3278.  
  3279.                   #include <math.h>
  3280.  
  3281.                   double x, dval, log(), log10();
  3282.  
  3283.                   dval = log(x);
  3284.                   dval = log10(x);
  3285.  
  3286.         log  returns the natural logarithm of x;  log10 returns the base 
  3287.         10 logarithm.
  3288.  
  3289.         NOTE: log and log10 return zero when x is zero or negative; 
  3290.         errno is set to EDOM.  EDOM is defined in math.h.
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.         The PCCS.S Standard Library                       Page 45
  3302.  
  3303.  
  3304.         7.9.31. lmove()
  3305.  
  3306.                   char *sp, *tp;
  3307.                   unsigned  num, sseg, tseg;
  3308.  
  3309.                 _lmove(number, sp, sseg, tp, tseg);
  3310.  
  3311.         _lmove  moves num  bytes from the 8088 physical address at 
  3312.         sseg:sp  to tseg:tp .  For example, to move the color display 
  3313.         frame buffer at address 0xB800:0 to a local buffer ( _showds  
  3314.         provides the C program data segment  Q DS)
  3315.  
  3316.                 _lmove(4000, 0, 0xB800, buffer, _showds());
  3317.  
  3318.         NOTE:  _lmove  takes advantage of the 8088 instructions for a 
  3319.         fast data move.  It handles overlapping moves correctly so that
  3320.  
  3321.                 _lmove(3920, 0, 0xB800, 80, 0xB800);
  3322.  
  3323.         will move 0xB800:3919 to 0xB800:3999,  0xB800:3918 to 0xB800:3998 
  3324.         etc. rather than propagating 0xB800:0.
  3325.  
  3326.  
  3327.         7.9.32. longjmp()
  3328.  
  3329.                   #include <setjmp.h>
  3330.  
  3331.                   int val;
  3332.                   jmp_buf env;
  3333.  
  3334.                   longjmp(env, val);
  3335.  
  3336.         jmp_buf is defined in <setjmp.h> .  It creates an environment 
  3337.         used by setjmp for future use by longjmp .  jmp_buf is defined 
  3338.         as
  3339.                 typedef char jmp_buf[6];
  3340.  
  3341.         longjmp restores SP, BP, and return address from env and returns 
  3342.         val.  val cannot be zero.
  3343.  
  3344.         NOTE:   env  can be specified as zero,  for  compatibility  with 
  3345.         previous releases.  There can be only one "zero" env  active at 
  3346.         any time.
  3347.  
  3348.         If the environment stored in env  points into an overlay area, 
  3349.         then the overlay that called setjmp  must be resident when 
  3350.         longjmp  is called Q if another overlay is resident, then strange 
  3351.         things will happen.  It is best to call setjmp  from the root.
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.         The PCCS.S Standard Library                       Page 46
  3368.  
  3369.  
  3370.         7.9.33. open()
  3371.  
  3372.                   int handle;
  3373.                   char *name, mode;
  3374.  
  3375.                   handle = open(name, mode)
  3376.  
  3377.         open opens the file name and returns an int that identifies the 
  3378.         file in  future  file operations.  Returns -1 if the file can't 
  3379.         be opened.
  3380.  
  3381.         mode is a char having one of the following values: 0 = open for 
  3382.         reading, 1 = open for writing, 2 = open for update, and 3 = open 
  3383.         for reading (CTRLZ indicates EOF).
  3384.  
  3385.         NOTES: Any of the functions can open the console ("CON") or 
  3386.         printer ("PRN").
  3387.  
  3388.  
  3389.         7.9.34. os()
  3390.  
  3391.                   char inum, ival;
  3392.                   unsigned arg;
  3393.                 
  3394.                   ival = _os(inum, arg);
  3395.                 _doint(inum);
  3396.                 dates(buf);
  3397.                 times(buf);
  3398.  
  3399.         _os provides an elementary interrupt interface.  Under DOS, inum  
  3400.         goes into AH and arg into DX, and an int 21H, is executed.  The 
  3401.         value in AL is returned.
  3402.  
  3403.  
  3404.         7.9.35. out()
  3405.  
  3406.                   char ch;
  3407.                   unsigned port, wd;
  3408.  
  3409.                 _outb(ch, port);
  3410.                 _outw(wd, port);
  3411.  
  3412.         _outb and _outw write the byte ch  and word wd, respectively, of 
  3413.         data out to the indicated port.
  3414.  
  3415.         7.9.36. peek()
  3416.  
  3417.                   char ch, *sp;
  3418.                   unsigned  sseg;
  3419.  
  3420.  
  3421.                   ch = _peek(sp, sseg);
  3422.  
  3423.         _peek  is used to retrieve a byte ch  from the 8088 physical 
  3424.         address at sseg:sp .
  3425.  
  3426.  
  3427.  
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.         The PCCS.S Standard Library                       Page 47
  3434.  
  3435.  
  3436.         7.9.37. poke()
  3437.  
  3438.                   char ch, *tp;
  3439.                   unsigned  tseg;
  3440.  
  3441.                   _poke(ch, tp, tseg);
  3442.  
  3443.         _poke  is used to store the byte ch  of data to the 8088 physical 
  3444.         address at tseg:tp .
  3445.  
  3446.  
  3447.         7.9.38. pow()
  3448.  
  3449.                   #include <math.h>
  3450.  
  3451.                   double x, y, dval, pow();
  3452.  
  3453.                   dval = pow(x, y);
  3454.  
  3455.         pow  returns x ** y.
  3456.  
  3457.         NOTE: pow returns a very large value when the result would 
  3458.         overflow; errno is set to ERANGE.  pow returns zero and sets 
  3459.         errno to EDOM when the second argument is negative and not 
  3460.         integral, or when both arguments are zero.  EDOM and ERANGE are 
  3461.         defined in math.h.
  3462.  
  3463.  
  3464.  
  3465.         7.9.39. putc()
  3466.  
  3467.                   #include <stdio.h>
  3468.                   FILE *fp;
  3469.                   char ch;
  3470.                   int data;
  3471.  
  3472.                   data = putc(ch, fp);
  3473.  
  3474.         putc writes ch to the file fp .  fp must have been opened prior 
  3475.         to the call.  The functions return ch, or -1 on error.
  3476.  
  3477.         SEE ALSO: printf(), fwrite()
  3478.  
  3479.  
  3480.         7.9.40. putchar()
  3481.  
  3482.                   #include <stdio.h>
  3483.                   FILE *fp;
  3484.                   char ch;
  3485.                   int data;
  3486.  
  3487.                   data = putchar(ch);
  3488.  
  3489.         putchar writes ch  to stdout .  Linefeed ('\n') is converted to 
  3490.         carriage return - linefeed ('\r\n').  Output will stop if CTRL-S 
  3491.  
  3492.  
  3493.  
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.         The PCCS.S Standard Library                       Page 48
  3500.  
  3501.  
  3502.         is entered, and resume when any other key is pressed.  Each 
  3503.         output will check for a CTRL-C entry, and terminate  the program 
  3504.         if it was pressed.  putchar returns ch , or -1 on error.
  3505.  
  3506.         SEE ALSO: printf(), fwrite()
  3507.  
  3508.         NOTE:  putchar is a function rather than the usual macro.
  3509.  
  3510.  
  3511.         7.9.41. puts()
  3512.  
  3513.                   char buf[];
  3514.                   int err;
  3515.  
  3516.                   err = puts(buf);
  3517.  
  3518.         puts copies the null terminated string buf to the console 
  3519.         (stdout).  puts returns a -1 on error.
  3520.  
  3521.         SEE ALSO: printf()
  3522.  
  3523.         NOTE:  puts  doesn't append a newline.
  3524.  
  3525.         On output, linefeed ('\n') is converted to carriage return - 
  3526.         linefeed ('\r\n').  Output will stop if CTRL-S is entered, and 
  3527.         resume when any other key is pressed.  Each output will check for 
  3528.         a CTRL-C entry, and terminate  the program if it was pressed.
  3529.  
  3530.  
  3531.         7.9.42. putw()
  3532.  
  3533.                   #include <stdio.h>
  3534.                   FILE *fp;
  3535.                   int data, w;
  3536.  
  3537.                   data = putw(w, fp);
  3538.  
  3539.         putw writes the int w to the file fp .  fp must have been 
  3540.         opened prior to the call.  putw  returns w, or -1 on error.
  3541.  
  3542.         SEE ALSO: printf(), fwrite()
  3543.  
  3544.         There is no way to distinguish the return from putw(-1, fp) from 
  3545.         an error.
  3546.  
  3547.  
  3548.         7.9.43. qsort()
  3549.                   char array[];
  3550.                   int num, width, (*compare)();
  3551.  
  3552.                   qsort(array, num, width, compare);
  3553.  
  3554.         qsort is an implementation of C. A. R. Hoare's quicker-sort  
  3555.         algorithm.  It sorts an array of num elements, each width  bytes 
  3556.         wide.  compare is called with two arguments -- pointers to the 
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.         The PCCS.S Standard Library                       Page 49
  3566.  
  3567.  
  3568.         two elements being compared, and returns an integer less than, 
  3569.         equal to, or greater than zero accordingly as the first argument 
  3570.         is less than, equal to, or greater than the second argument.
  3571.  
  3572.         NOTE:  The usual function for compare is strcmp().  If you are 
  3573.         sorting anything other than strings, the following may serve as a 
  3574.         model:
  3575.  
  3576.                 int compare(left, right)
  3577.                 int *left, *right; {
  3578.                         return *left - *right;
  3579.                         }
  3580.  
  3581.                 #define TCARD    1024
  3582.                 #define ISIZE    sizeof(int)
  3583.  
  3584.                 int itab[TCARD];
  3585.  
  3586.                         qsort(itab, TCARD, ISIZE, compare);
  3587.  
  3588.         Remember that int, long, float, and double values are stored with 
  3589.         their low-order bytes first.  Thus string comparisons may not 
  3590.         produce the expected results.
  3591.  
  3592.  
  3593.         7.9.44. rand()
  3594.  
  3595.                   int ival;
  3596.  
  3597.                   ival = rand();
  3598.  
  3599.         rand returns the next pseudo-random number in the range from 0 
  3600.         to 2**15 - 1.
  3601.  
  3602.  
  3603.         7.9.45. rename()
  3604.  
  3605.                   char *oldFile, *newFile;
  3606.                   int stat;
  3607.  
  3608.                   stat = rename(oldFile, newFile);
  3609.  
  3610.         rename changes the file name oldFile to newFile.  Under DOS 2.X 
  3611.         and higher, oldFile may contain a path specification.  Returns -1 
  3612.         if oldFile is open, or if an error is detected.
  3613.  
  3614.  
  3615.         7.9.46. rindex()
  3616.  
  3617.                   char *cp, *src, ch;
  3618.  
  3619.                   cp = index(src, ch);
  3620.  
  3621.         rindex works on null-terminated strings.  There is no test for 
  3622.         overflow.
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.         The PCCS.S Standard Library                       Page 50
  3632.  
  3633.  
  3634.  
  3635.         rindex returns a pointer to the last occurance of ch in src or 0 
  3636.         if ch doesn't occur.
  3637.  
  3638.  
  3639.         7.9.47. scanf()
  3640.  
  3641.                   char fcs[];
  3642.                   int num;
  3643.  
  3644.                   num = scanf(fcs [, ptr ] ... );
  3645.  
  3646.  
  3647.         scanf reads from stdin.
  3648.  
  3649.         Returns the number of items successfully scanned.
  3650.  
  3651.         The format control string, fcs, contains: blanks or tabs, which 
  3652.         match optional whitespace (blanks, tabs, newlines, formfeeds, and 
  3653.         vertical tabs) in the input; a non-'%'  character which must 
  3654.         match the next character in the input, and conversion control 
  3655.         strings which describe the type and format of each *ptr.  
  3656.         Conversion control strings have the following format ([] enclose 
  3657.         optional entries):
  3658.  
  3659.                 %[*][width][parms]code
  3660.  
  3661.         where:  *  indicates  that  the field should be skipped  and  not 
  3662.         assigned  to a *ptr ,  width specifies the maximum field size  in 
  3663.         bytes.   Both parms and code are described below.   The  examples 
  3664.         have the following form:
  3665.  
  3666.                 | input string |  . function call . result 
  3667.  
  3668.         Character:  %[*][width]c
  3669.            String:  %[*][width]s
  3670.  
  3671.         width  specifies the number of characters to be read into the 
  3672.         array at *ptr .  The default is 1.  'c' whitespace is not 
  3673.         skipped, 's' whitespace is.
  3674.  
  3675.                 |  abc| . scanf("%3c", buf) . |  a|
  3676.                 |  abc| . scanf("%3s", buf) . |abc|
  3677.  
  3678.         Integer:  %[*][width][size]code
  3679.  
  3680.         size  equal to 'l' (lowercase 'L') specifies that *ptr  point to 
  3681.         a long, a 'h' specifies a short int .
  3682.  
  3683.  
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.         The PCCS.S Standard Library                       Page 51
  3698.  
  3699.  
  3700.         code  is one of: 'd' Q signed decimal format, 'u' Q unsigned 
  3701.         decimal format, 'o' Q unsigned octal, and 'x' Q unsigned 
  3702.         hexadecimal.
  3703.  
  3704.                 |  FF | . scanf("%x", &hex)  .  255
  3705.                 | 377 | . scanf("%o", &oct)  .  255
  3706.                 | 255 | . scanf("%u", &uns)  .  255
  3707.                 |-255 | . scanf("%ld", &lng) . -255L
  3708.  
  3709.         Floating Point:  %[*][width][size]code
  3710.  
  3711.         size  equal to 'l' (lowercase 'L') specifies that *ptr  points to 
  3712.         a double rather than a float.
  3713.  
  3714.         code  can be either 'e', 'f', or 'g' Q they all indicate floating 
  3715.         point.
  3716.  
  3717.                 | 123.45 | . scanf("%f", %flt)       . 123.45
  3718.                 | 123.45 | . scanf("%4lf%d", &d, &i) . 123.0  45
  3719.  
  3720.  
  3721.         Scanset:  %[*][width]scanset
  3722.  
  3723.         scanset  is specified by a sequence of characters enclosed by 
  3724.         brackets '[' ']'.  It reads a string, including the terminating 
  3725.         null character.  Leading whitespace is not skipped.
  3726.  
  3727.                 |123 ABC| . scanf("%[123 ]", str) . |123 |
  3728.  
  3729.         A range of contiguous characters can be specified by the first 
  3730.         and last element of the range, separated by a '-'.
  3731.  
  3732.                 |123 ABC| . scanf("%[1-3 ]", str) . |123 |
  3733.  
  3734.         If the first element of scanset  is a '^', then all characters 
  3735.         except  those specified will be read.
  3736.  
  3737.                 |123 ABC| . scanf("%[^A-C]", str) . |123 |
  3738.  
  3739.         To specify '-' or ']' in a scanset , specify it as the first 
  3740.         element.  Thus to read an integer, skip any interviening garbage, 
  3741.         and read another integer
  3742.  
  3743.                 scanf("%d%*[^-+0-9]%d", &dig1, &dig2);
  3744.  
  3745.  
  3746.  
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.         The PCCS.S Standard Library                       Page 52
  3764.  
  3765.  
  3766.         7.9.48. scr_aputs()
  3767.  
  3768.                   char *str, attr;
  3769.  
  3770.                   scr_aputs(str, attr);
  3771.  
  3772.         scr_aputs writes string str to the display with attribute attr.  
  3773.         '\r' moves to the begining of the line, and '\n' moves to the 
  3774.         next line.  Moving off the bottom line causes scrolling.
  3775.  
  3776.         NOTE:  scr_aputs is in the file PCIO.A.
  3777.  
  3778.  
  3779.         7.9.49. scr_ci()
  3780.  
  3781.                   char ch;
  3782.  
  3783.                   ch = scr_ci();
  3784.  
  3785.         scr_ci is like ci() but uses its own translation table for 
  3786.         command characters.  It returns the next character from the input 
  3787.         queue.
  3788.  
  3789.         NOTE:  scr_ci is in the file PCIO.A.
  3790.  
  3791.  
  3792.         7.9.50. scr_co()
  3793.  
  3794.                   char ch;
  3795.  
  3796.                   scr_co(ch);
  3797.         scr_co is the same as co() -- it writes a single character out to 
  3798.         the screen.
  3799.  
  3800.         NOTE:  scr_co is in the file PCIO.A.
  3801.  
  3802.  
  3803.         7.9.51. scr_clr()
  3804.  
  3805.                   scr_clr();
  3806.  
  3807.         scr_clr erases the entire screen and sets the cursor to the home, 
  3808.         (0,0) location.
  3809.  
  3810.         NOTE:  scr_clr is in the file PCIO.A.
  3811.  
  3812.  
  3813.         7.9.52. scr_clrl()
  3814.  
  3815.                   scr_clrl();
  3816.  
  3817.         scr_clrl erases everything from the cursor location to the end of 
  3818.         the line.
  3819.  
  3820.         NOTE:  scr_clrl is in the file PCIO.A.
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.         The PCCS.S Standard Library                       Page 53
  3830.  
  3831.  
  3832.         7.9.53. scr_cls()
  3833.  
  3834.                   scr_cls();
  3835.  
  3836.         scr_cls erases everything from the cursor location to the end  of 
  3837.         the screen.
  3838.  
  3839.         NOTE:  scr_cls is in the file PCIO.A.
  3840.  
  3841.  
  3842.         7.9.54. scr_csts()
  3843.  
  3844.                   char ch;
  3845.  
  3846.                   ch = scr_csts();
  3847.  
  3848.         scr_csts returns the next character from the queue, or 0 if no 
  3849.         character is available.  If a character is present, it is 
  3850.         equivalent to a csts() followed by a ci().
  3851.  
  3852.         NOTE:  scr_csts is in the file PCIO.A.
  3853.  
  3854.         Function keys return a zero.
  3855.  
  3856.  
  3857.         7.9.55. scr_cursoff()
  3858.  
  3859.                   scr_cursoff();
  3860.  
  3861.         scr_cursoff turns the cursor off.
  3862.  
  3863.         NOTE:  scr_cursoff is in the file PCIO.A.
  3864.  
  3865.  
  3866.         7.9.56. scr_curson()
  3867.  
  3868.                   scr_curson();
  3869.  
  3870.         scr_curson turns the cursor on.
  3871.  
  3872.         NOTE:  scr_curson is in the file PCIO.A.
  3873.  
  3874.  
  3875.         7.9.57. scr_rowcol()
  3876.  
  3877.                   int trow, tcol;
  3878.  
  3879.                   scr_rowcol(trow, tcol);
  3880.  
  3881.         scr_rowcol moves the cursor to row trow and column tcol.
  3882.  
  3883.         NOTE:  scr_rowcol is in the file PCIO.A.
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.         The PCCS.S Standard Library                       Page 54
  3896.  
  3897.  
  3898.         7.9.58. scr_scdn()
  3899.  
  3900.                   scr_scdn();
  3901.  
  3902.         scr_scdn scrolls the screen down one line, but leaves the top two 
  3903.         lines alone.
  3904.  
  3905.         NOTE:  scr_scdn is in the file PCIO.A.
  3906.  
  3907.  
  3908.         7.9.59. scr_scrdn()
  3909.  
  3910.                   int lines, frow, fcol, trow, tcol;
  3911.  
  3912.                   scr_scrdn(lines, frow, fcol, trow, tcol);
  3913.  
  3914.         scr_scrdn scrolls the given area down lines.  The area is defined 
  3915.         by the character locations (frow, fcol), (trow, tcol).
  3916.  
  3917.         NOTE:  scr_scrdn is in the file PCIO.A.
  3918.  
  3919.  
  3920.         7.9.60. scr_scrup()
  3921.  
  3922.                   int lines, frow, fcol, trow, tcol;
  3923.  
  3924.                   scr_scrup(lines, frow, fcol, trow, tcol);
  3925.  
  3926.         scr_scrup scrolls the area up lines.  The area is defined by the 
  3927.         character locations (frow, fcol), (trow, tcol).
  3928.  
  3929.         NOTE:  scr_scup is in the file PCIO.A.
  3930.  
  3931.  
  3932.         7.9.61. scr_scup()
  3933.  
  3934.                   scr_scup();
  3935.  
  3936.         scr_scup scrolls the screen up one line, but leaves the top two 
  3937.         lines alone.
  3938.  
  3939.         NOTE:  scr_scup is in the file PCIO.A.
  3940.  
  3941.  
  3942.         7.9.62. scr_setmode()
  3943.  
  3944.                   char newMode;
  3945.  
  3946.                   scr_setmode(newMode);
  3947.  
  3948.         scr_setmode  sets the mode of the color card.  newMode  must be 
  3949.         between 0 and 6.
  3950.  
  3951.         NOTE:  scr_setmode is in the file PCIO.A.
  3952.  
  3953.  
  3954.  
  3955.  
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.         The PCCS.S Standard Library                       Page 55
  3962.  
  3963.  
  3964.         scr_setmode manages the following global data.
  3965.  
  3966.                 char scr_cols;  /* number of character positions */
  3967.                 char scr_rows;  /* number of lines */
  3968.                 char scr_mode;  /* current screen mode:
  3969.                                 0 = 40 col. BW
  3970.                                 1 = 40 col. color
  3971.                                 2 = 80 col. BW
  3972.                                 3 = 80 col. color
  3973.                                 4 = 320 x 200 color graphics
  3974.                                 5 = 320 x 200 BW graphics
  3975.                                 6 = 640 x 200 BW graphics
  3976.                                 7 = 80 col. BW    */
  3977.                 char scr_page;  /* current active display page */
  3978.                 char scr_attr;  /* current character attribute.
  3979.                                 Normally 7 for white on black but
  3980.                                 can be set for any attributes
  3981.                                 see Technical Reference Manual */
  3982.  
  3983.  
  3984.         7.9.63. scr_setup()
  3985.  
  3986.                   scr_setup();
  3987.  
  3988.         scr_setup   must be called prior to any of the screen routines if 
  3989.         the screen is currently in 80 column mode or if scr_curson with a 
  3990.         monochrome display is used.
  3991.  
  3992.         NOTE:  scr_setup is in the file PCIO.A.
  3993.  
  3994.         scr_setup manages the same data as scr_setmode.
  3995.  
  3996.  
  3997.         7.9.64. scr_sinp()
  3998.  
  3999.                   char ch;
  4000.  
  4001.                   ch = scr_sinp();
  4002.  
  4003.         scr_sinp returns the character under the cursor on the screen.
  4004.  
  4005.         NOTE:  scr_sinp is in the file PCIO.A.
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.         The PCCS.S Standard Library                       Page 56
  4028.  
  4029.  
  4030.         7.9.65. setjmp()
  4031.  
  4032.                   #include <setjmp.h>
  4033.  
  4034.                   int val;
  4035.                   jmp_buf env;
  4036.  
  4037.                   val = setjmp(env);
  4038.  
  4039.         jmp_buf is defined in <setjmp.h> .  It creates an environment 
  4040.         used by setjmp  for future use by longjmp .  jmp_buf is defined 
  4041.         as
  4042.                 typedef char jmp_buf[6];
  4043.  
  4044.         setjmp  saves the current SP, BP, and return address in env.  It 
  4045.         returns a zero.
  4046.  
  4047.         NOTE:  env can be specified as zero, for compatibility with 
  4048.         previous releases.  There can be only one "zero" env  active at 
  4049.         any time.
  4050.  
  4051.         If the environment stored in env  points into an overlay area, 
  4052.         then the overlay that called setjmp  must be resident when 
  4053.         longjmp  is called -- if another overlay is resident, then 
  4054.         strange things will happen.  It is best to call setjmp  from the 
  4055.         root.
  4056.  
  4057.         setjmp's caller can tell by the returned value if control was 
  4058.         returned from setjmp(0), or from longjmp(!=0).
  4059.  
  4060.  
  4061.         7.9.66. sqrt()
  4062.  
  4063.                   #include <math.h>
  4064.  
  4065.                   double x, dval, sqrt();
  4066.  
  4067.                   dval = sqrt(x);
  4068.  
  4069.         sqrt returns the square root of x.
  4070.  
  4071.         NOTE: sqrt returns zero when x is negative; errno is set to EDOM.
  4072.         EDOM is defined in math.h.
  4073.  
  4074.  
  4075.  
  4076.         7.9.67. srand()
  4077.  
  4078.                   int seed;
  4079.  
  4080.                   srand(seed);
  4081.  
  4082.         srand sets the seed for the multiplicative congruential random 
  4083.         number generator to seed .
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.         The PCCS.S Standard Library                       Page 57
  4094.  
  4095.  
  4096.         NOTE:  The initial seed for the generator is a long.  srand  only 
  4097.         sets the low order word, so the initial generator cannot be 
  4098.         restarted.  Solution: seed the generator with your own integer 
  4099.         before any calls to rand or frand .
  4100.  
  4101.  
  4102.         7.9.68. sscanf()
  4103.  
  4104.                   char fcs[], buf[];
  4105.  
  4106.                   num = sscanf(buf, fcs [, ptr ] ... );
  4107.  
  4108.         sscanf reads from the string buf.
  4109.  
  4110.         Returns the number of items successfully scanned.
  4111.  
  4112.         See scanf() for a how it works.
  4113.  
  4114.  
  4115.         7.9.69. strcat()
  4116.  
  4117.                   char *cp, *src, *dst;
  4118.  
  4119.                   cp = strcat(dst, src);
  4120.  
  4121.         strcat works on null-terminated strings.  There is no test for 
  4122.         overflow.
  4123.  
  4124.         strcat appends a copy of src to the end of dst.
  4125.  
  4126.         Returns dst .
  4127.  
  4128.  
  4129.         7.9.70. strcmp()
  4130.  
  4131.                   char *s1, *s2;
  4132.                   int cmp;
  4133.  
  4134.                   cmp = strcmp(s1, s2);
  4135.  
  4136.         strcmp works on null-terminated strings.  There is no test for 
  4137.         overflow.
  4138.  
  4139.         strcmp  compares the two strings and returns +1, 0, or -1 
  4140.         accordingly as s1 is lexically greater than, equal to, or less 
  4141.         than s2.
  4142.  
  4143.         7.9.71. strcpy()
  4144.  
  4145.                   char *cp, *src, *dst;
  4146.  
  4147.                   cp = strcpy(dst, src);
  4148.  
  4149.         strcpy works on null-terminated strings.  There is no test for 
  4150.         overflow.
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.         The PCCS.S Standard Library                       Page 58
  4160.  
  4161.  
  4162.         strcpy copies src to dst , stopping after the null byte has been 
  4163.         transfered.
  4164.           
  4165.         Returns dst .
  4166.  
  4167.  
  4168.         7.9.72. strlen()
  4169.  
  4170.                   char *src;
  4171.                   unsigned len;
  4172.  
  4173.                   len = strlen(src);
  4174.  
  4175.         strlen works on null-terminated strings.  There is no test for 
  4176.         overflow.
  4177.  
  4178.         strlen returns the number of non-null characters in src.
  4179.  
  4180.  
  4181.         7.9.73. strncat()
  4182.  
  4183.                   char *cp, *src, *dst;
  4184.                   unsigned max;
  4185.  
  4186.                   cp = strncat(dst, src, max);
  4187.  
  4188.         strncat works on null-terminated strings.  There is no test for 
  4189.         overflow.
  4190.  
  4191.         strncat appends, at most, max  bytes of src  to the end of dst.
  4192.           
  4193.         Returns dst .
  4194.  
  4195.  
  4196.         7.9.74. strncmp()
  4197.  
  4198.                   char *s1, *s2;
  4199.                   int cmp;
  4200.                   unsigned max;
  4201.  
  4202.                   cmp = strncmp(s1, s2, max);
  4203.  
  4204.         strncmp works on null-terminated strings.  There is no test for 
  4205.         overflow.
  4206.  
  4207.         strncmp compares, at most, max  bytes of the two strings and 
  4208.         returns +1, 0, or -1 accordingly as s1 is lexically greater than, 
  4209.         equal to, or less than s2.
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.         The PCCS.S Standard Library                       Page 59
  4226.  
  4227.  
  4228.         7.9.75. strncpy()
  4229.  
  4230.                   char *cp, *src, *dst;
  4231.                   unsigned len;
  4232.  
  4233.                   cp = strncpy(dst, src, len);
  4234.  
  4235.         strncpy works on null-terminated strings.  There is no test for 
  4236.         overflow.
  4237.  
  4238.         strncpy copies exactly len bytes, from src to dst truncating or 
  4239.         null-padding as required; dst may not be null-terminated if the 
  4240.         strlen(src) >= len.
  4241.  
  4242.         Returns dst .
  4243.  
  4244.  
  4245.         7.9.76. times()
  4246.  
  4247.                   char *buf;
  4248.  
  4249.                 times(buf);
  4250.  
  4251.         times formats the string buf with the current time as "hh-mm-ss"
  4252.  
  4253.  
  4254.         7.9.77. ungetc()
  4255.  
  4256.                   #include <stdio.h>
  4257.                   FILE *fp;
  4258.                   char ch;
  4259.                   int data;
  4260.  
  4261.                   data = ungetc(ch, fp)
  4262.  
  4263.         ungetc pushes the character ch  back onto the file fp.  The next 
  4264.         call to getc or fgetc will return ch.  ungetc returns ch, or -1 
  4265.         if it can't push the character back.  fseek  clears all pushed 
  4266.         characters.  EOF (-1) can't be pushed.
  4267.  
  4268.  
  4269.         7.9.78. unlink()
  4270.  
  4271.                   char *oldFile;
  4272.                   int stat;
  4273.  
  4274.                   stat = unlink(oldFile);
  4275.  
  4276.         unlink deletes the file oldFile.  Under DOS 2.X and higher, 
  4277.         oldFile may contain a path specification.  Returns -1 if oldFile  
  4278.         doesn't exist, is open, or if an error is detected.
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.         Messages                                            Page 60
  4292.  
  4293.  
  4294.         A. Messages
  4295.  
  4296.         A.1. PCC Compiler Messages
  4297.  
  4298.         A.1.1. Banner and Termination Messages
  4299.  
  4300.         >PCC V2.1c  Copyright Mark DeSmet 1989
  4301.         end of PCC    001A code    0012 data     1% utilization
  4302.  
  4303.         OR
  4304.  
  4305.         >PCC V2.1c  Copyright Mark DeSmet 1989
  4306.              (various error messages)
  4307.  
  4308.             Number of Warnings = 2     Number of Errors = 5
  4309.  
  4310.         The first form of termination means the compile was successful.  
  4311.         The 'code' number is in hex and tells how many bytes of code were 
  4312.         produced.  The 'data' number is similar and tells how many bytes 
  4313.         of data were produced.  The utilization percentage is the worst 
  4314.         case of a number of compiler limits.  If it nears 100% it usually 
  4315.         means that the largest procedure should be broken into smaller 
  4316.         procedures.
  4317.  
  4318.         The second form means the compile failed.  Error messages are 
  4319.         explained in the following section.  If any errors were detected, 
  4320.         the compiler will stop trying to generate code and will stop as 
  4321.         soon as all the source has been read.  This 'syntax check' mode 
  4322.         is fast and allows the programmer to correct the program with a 
  4323.         minimum of delay.  If only warnings were detected, but no errors, 
  4324.         compilation will end normally and produce a .O file.
  4325.  
  4326.  
  4327.         A.1.2. Messages
  4328.  
  4329.         PCC produces four categories of messages: fatal errors, errors, 
  4330.         warnings and errors detected by the assembler.  Fatal errors are 
  4331.         usually caused by I/O errors but compiler errors are also in this 
  4332.         category.  When a fatal error is detected, the compiler will 
  4333.         print a message and quit.  Errors are caused by syntax errors.  
  4334.         PCC reports all such errors and then quits.  Warnings are 
  4335.         produced by correctable errors and the compiler continues.  Since 
  4336.         the compiler uses PCCA as pass 3, assembler detected errors are 
  4337.         possible but rare.  When they occur, the object module will not 
  4338.         be usable.
  4339.  
  4340.         It is easy to tell the category of an error.  After a fatal 
  4341.         error, the compiler stops without printing a termination message. 
  4342.         Errors and warnings have a distinctive format which includes the  
  4343.         word 'error' or 'warning'.  Assembler errors print the assembler 
  4344.         line that was found offensive.
  4345.  
  4346.  
  4347.         A.1.2.1. PCC Fatal Errors
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.         Messages                                            Page 61
  4358.  
  4359.  
  4360.         The pass 2 fatal errors like 'bad expression' are compiler  
  4361.         errors, but the error is usually in not detecting the problem in 
  4362.         pass 1 and printing a reasonable message.  If you get one of 
  4363.         these errors, please send your program to C Ware, but you can  
  4364.         probably find and eliminate the statement that caused the 
  4365.         problem.  Don't be frightened by seeing these errors listed; you 
  4366.         will probably never see any of them.
  4367.  
  4368.         bad  expression - this indicates a compiler error.   Printed by 
  4369.                         pass 2.
  4370.  
  4371.  
  4372.         bad GOTO target - attempt to goto something other than a label.
  4373.  
  4374.         break/case/continue/default not in switch - a case or default 
  4375.                         statement must be within a switch. A break 
  4376.                         statement must be in a while or do..while or for 
  4377.                         or switch. A continue statement must be in a 
  4378.                         while or do..while or for statement.
  4379.  
  4380.         cannot address  - illegal use of '&' operator.  Printed in pass 
  4381.                         2.
  4382.  
  4383.         cannot close <file> - the file could not be closed.   An I/O 
  4384.                         error occurred.
  4385.  
  4386.         cannot create <file> - the named file could not be created.  The 
  4387.                         name is a temporary name or the name of the 
  4388.                         object or assembler file.  This message usually 
  4389.                         means the drive is full (see 'T' option).
  4390.  
  4391.         cannot open <file> - the named source or include file could not 
  4392.                         be found.
  4393.  
  4394.         cannot read <file> - the named file could not be read.  Usually 
  4395.                         means an I/O error was detected.
  4396.  
  4397.         cannot unlink <file> - the temporary could not be deleted.  An 
  4398.                         I/O error occurred.
  4399.  
  4400.         cannot write <file> - the named file could not be written. An I/O 
  4401.                         error was detected.  Usually means the disk drive 
  4402.                         is out of space.
  4403.  
  4404.         error in register allocation - compiler error in pass 2. 
  4405.  
  4406.         divide by zero  - a constant expression evaluated to a divide by 
  4407.                         zero.  Should never happen.
  4408.  
  4409.         function too big - a function is too big for the compiler.  The 
  4410.                         'Utilization' number reflects this limit so there 
  4411.                         is normally plenty of warning.  The solution is 
  4412.                         to break large procedures into smaller ones.
  4413.  
  4414.         illegal initialization for <name> - only constant expressions and 
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.         Messages                                            Page 62
  4424.  
  4425.  
  4426.                         addresses plus or minus constant expressions can 
  4427.                         be used in initialization and the initialization 
  4428.                         must make sense.   For example
  4429.  
  4430.                         int a=b+2;
  4431.  
  4432.                         this error is fatal because it is not discovered 
  4433.                         until pass 2.
  4434.  
  4435.         no cases        - a switch must have at least one case.
  4436.  
  4437.         no input file   - PCC must be followed by the name of the source 
  4438.                         file when invoked.
  4439.  
  4440.         out of memory   - the compiler ran out of symbol space.  The 
  4441.                         'utilization' numbers warn when a program is 
  4442.                         about to exceed this or any other compiler limit.  
  4443.                         The compiler can use up to 100K, so adding memory 
  4444.                         may be a solution.  If not, the only remedy is 
  4445.                         the painful surgery required to reduce the total 
  4446.                         number of externals and locals defined at one 
  4447.                         time.
  4448.                         
  4449.         pushed          - compiler error in pass 2 code generation. It 
  4450.                         can be eliminated by simplifying the expression.
  4451.  
  4452.         too many cases  - currently, a switch statement can only contain 
  4453.                         128 case statements.
  4454.  
  4455.  
  4456.         too many fors/too many whiles - whiles, do-whiles, switches and 
  4457.                         for statements can only be nested 10 deep.
  4458.  
  4459.         stuck <register> - same as 'pushed'.
  4460.  
  4461.         too many externals - the compiler currently has a limit of 500 
  4462.                         static's or extern's.
  4463.  
  4464.  
  4465.         A.1.2.2. PCC Errors
  4466.  
  4467.         Errors are printed with the following format:
  4468.  
  4469.             23 if (i < 99 $$ {
  4470.                error:Need ()
  4471.  
  4472.         Or, if the error was detected in an include file:
  4473.  
  4474.             23 if (i < 99 $$ {
  4475.                file:<include file> error:Need ()
  4476.  
  4477.         The number preceding the source line is the line number.  To find 
  4478.         the line , edit the file and issue the command 'nnnJ' where nnn 
  4479.         is the number of the reported line.
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.         Messages                                            Page 63
  4490.  
  4491.  
  4492.         The '$$' shows how far into the line the compiler was before the 
  4493.         error was detected.  For example, the '$$' will print immediately 
  4494.         BEFORE an undefined variable.
  4495.  
  4496.         If you get a lot of errors on a compile, don't panic. A trivial 
  4497.         error probably caused the compiler to become confused.  Correct 
  4498.         the first few errors and re-compile.
  4499.  
  4500.         bad control     - the # control is illegal.
  4501.  
  4502.         bad declaration - the declaration of a variable was illegal.
  4503.  
  4504.         bad include     - the #include must be followed by "name" or 
  4505.                         <name>.
  4506.  
  4507.  
  4508.         bad label       - a colon is not preceded by a label name.
  4509.  
  4510.         bad member declare - the declaration of a member is illegal.
  4511.  
  4512.         bad member storage - an attempt was made to declare a member 
  4513.                         static or external.   Members have the storage 
  4514.                         type of their struct or union.
  4515.  
  4516.         bad parameter declare - an illegal declaration of an argument or 
  4517.                         the name of the argument was spelled differently 
  4518.                         in the procedure heading  and in the declaration.
  4519.  
  4520.         bad statement   - illegal statement.
  4521.  
  4522.         defines too deep - #define may reference another, but there is a 
  4523.                         limit. When #defines are expanded, the number of 
  4524.                         active #defines plus the number of #define 
  4525.                         arguments referenced by each cannot exceed 30.
  4526.  
  4527.         duplicate argument - an attempt was made to declare an argument 
  4528.                         twice.
  4529.  
  4530.         duplicate label - two labels have the same name.
  4531.  
  4532.         EOF within comment - end of file was found inside a comment. A 
  4533.                         '*/' is missing.
  4534.  
  4535.         field needs constant - the size of a bit field must be a constant 
  4536.                         expression with a value of 1 to 16.
  4537.  
  4538.         illegal address - attempt to use the '&' (take address of) 
  4539.                         operator on something that is not a lvalue.  
  4540.                         '&44' will generate this error.  An address can 
  4541.                         only be taken of a variable, procedure, string or 
  4542.                         label.
  4543.  
  4544.  
  4545.         illegal define  - a #define has unmatched parenthesis or the 
  4546.                         #define parameters are illegally specified.
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.         Messages                                            Page 64
  4556.  
  4557.  
  4558.  
  4559.         illegal external declaration - caused both by an illegal data or 
  4560.                         procedure declaration and improperly nested 
  4561.                         braces.  If the line is supposed to be part of a 
  4562.                         procedure (e.g. i=0;), the latter is the case.  
  4563.                         Check that every '{' outside of a comment or 
  4564.                         quoted string has a matching '}'.  Note: a prior 
  4565.                         error may have caused the compiler to lose track 
  4566.                         of a '{'.
  4567.  
  4568.         illegal indirection - caused by trying to use a char, int, 
  4569.                         unsigned, float or double as a pointer.  longs 
  4570.                         can be used as pointers but the other types 
  4571.                         cannot.
  4572.  
  4573.         include nesting too deep - includes can only be nested three deep
  4574.  
  4575.         illegal use of float - floating point numbers cannot be used as 
  4576.                         pointers.
  4577.  
  4578.         line must be constant - a #line control must be followed by a 
  4579.                         decimal constant.
  4580.  
  4581.         line too long   - the maximum line length is 128.
  4582.  
  4583.         missing ";", "(", ")", "[", "]", "{", "}", ":", "|" - the 
  4584.                         indicated "" character is needed at this point. A 
  4585.                         multitude of errors can cause these messages.  
  4586.                         The error might be fixed by sticking in the 
  4587.                         indicated character where the '$$' prints, but 
  4588.                         the item following the '$$' could be illegal.
  4589.  
  4590.         missing '       - a character constant (e.g. 'A','TEXT') can only 
  4591.                         contain one to four characters.
  4592.  
  4593.         missing argument - the argument list of a call had two adjacent 
  4594.                         commas.
  4595.  
  4596.         missing arguments - a #define was defined with arguments but used 
  4597.                         without arguments.
  4598.  
  4599.         missing dimension - an array dimension was missing in an 
  4600.                         expression or statement.  Either int x[][]; or 
  4601.                         x[]=1;.
  4602.  
  4603.         missing end of #asm - an #asm block was not ended with a #.
  4604.  
  4605.         missing expression - an expression is needed here. An example of 
  4606.                         a missing expression is i=;.
  4607.  
  4608.         missing operand - an operator without an operand was found.  An 
  4609.                         example of a missing operand is ++;
  4610.  
  4611.         missing while   - a 'do ... while' is missing the ending 'while'.
  4612.  
  4613.  
  4614.  
  4615.  
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.         Messages                                            Page 65
  4622.  
  4623.  
  4624.         must return float - a float or double function must end with a 
  4625.                         return statement that returns a value.
  4626.  
  4627.                         Note:  The compiler is too stupid to accept.
  4628.                 
  4629.                         double x(){if (1) return 1.;}.
  4630.  
  4631.         need ()         - the expression following an 'if' or 'switch' or 
  4632.                         'while' was not surrounded by parenthesis.
  4633.  
  4634.         need '{' for STRUCT initialization - the initial values used to 
  4635.                         initialize a structure must be surrounded by 
  4636.                         braces.
  4637.  
  4638.         need constant   - a 'case' prefix must be followed by an integer 
  4639.                         constant expression.
  4640.  
  4641.         need constant after #if - a #if control must be followed by a 
  4642.                         constant expression.
  4643.  
  4644.         need label      - a goto must reference a label.
  4645.  
  4646.         need lval       - a lvalue is needed here. An lvalue is, roughly, 
  4647.                         something that can be changed with an assignment.  
  4648.                         The statement: 2=4; will produce this error.
  4649.  
  4650.         need member     - the '.' or '->' operators were followed by 
  4651.                         something other than a member name.
  4652.  
  4653.         need structure  - the name prior to a '.' operator is not the 
  4654.                         name of a struct or union.
  4655.  
  4656.         not an identifier - #ifdef, #ifndef and #undef controls must 
  4657.                         reference a #define value;.
  4658.  
  4659.         not defined     - #undef controls must reference a #define 
  4660.                         value;.
  4661.  
  4662.         only STATIC and EXTERN allowed at this level - an attempt was 
  4663.                         made to declare an 'auto' outside of a procedure.
  4664.  
  4665.         parameters cannot span lines - the arguments to a #define must 
  4666.                         all be on the same line.
  4667.  
  4668.         return lacks argument - if a function is declared as returning a 
  4669.                         value then "return;" is illegal.  Use "return 0;" 
  4670.                         if the value is unimportant.
  4671.  
  4672.         sorry, must have dimension for locals - the compiler does not 
  4673.                         accept char a[]={1,2,3}; and similar  for auto 
  4674.                         variables.  Declare the variable static or 
  4675.                         include an explicit dimension.
  4676.  
  4677.         sorry, no string initialization of AUTO - the compiler cannot 
  4678.                         accept char a[]="abc"; and similar for auto 
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.         Messages                                            Page 66
  4688.  
  4689.  
  4690.                         variables.  Declare the variable static if 
  4691.                         possible, otherwise use _move.
  4692.  
  4693.         string too long - a string cannot exceed 200 characters.  Usually 
  4694.                         means that a '"' is missing.
  4695.  
  4696.         undefined structure - a  pointer to an undefined structure cannot 
  4697.                         be added to.
  4698.  
  4699.         unknown control - the word following a '#' is not a control word.  
  4700.                         '#while' would cause this error.
  4701.  
  4702.         unmatched "     - either the end of line or end of file was found 
  4703.                         in a string.  Usually means that a " is missing. 
  4704.                         if your string is too long for one line, continue 
  4705.                         with a \ (backslash) at the end of a line and 
  4706.                         continue in column one of the next.  If you want 
  4707.                         a new line in a string, use \n.
  4708.  
  4709.         wrong number of arguments - a #define was used with the wrong 
  4710.                         number of arguments.
  4711.  
  4712.  
  4713.         A.1.2.3. PCC Warnings
  4714.  
  4715.         There are currently only two warnings. Warnings indicate 
  4716.         suspicious code that is probably OK.
  4717.  
  4718.         conflicting types - an external or static was declared twice with 
  4719.                         different types.  Usually caused by an include 
  4720.                         file declaring a variable incorrectly or by a 
  4721.                         program such as:
  4722.  
  4723.                         main() {
  4724.                                 char ch;
  4725.          
  4726.                                 ch=zipit();
  4727.                                 }
  4728.          
  4729.                         char zipit(ch)
  4730.                         char ch; {
  4731.  
  4732.                                 return ch;
  4733.                                 }
  4734.  
  4735.                         the call of zipit implicitly declares it to be a 
  4736.                         function  returning an integer.  The line 'char 
  4737.                         zipit(ch)' would be flagged as an error.  The fix 
  4738.                         is to include:
  4739.  
  4740.                         char zipit();
  4741.  
  4742.                         above the call so the function is declared 
  4743.                         correctly before use.
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.         Messages                                            Page 67
  4754.  
  4755.  
  4756.         undefined variable - the variable has not been defined.  It is 
  4757.                         assumed to be an auto int.
  4758.  
  4759.  
  4760.  
  4761.         A.1.2.4. PCCA Errors ( from PCC Execution )
  4762.  
  4763.         In theory, any PCCA error message can be produced by a PCC 
  4764.         compile gone bonkers but I have only seen the 'cannot write 
  4765.         <name>' errors caused by lack of disk space.
  4766.  
  4767.  
  4768.  
  4769.  
  4770.         A.2. PCCA Assembler Messages
  4771.  
  4772.         A.2.1. Banner and Termination Messages
  4773.  
  4774.         >PCCA 8088 Assembler V1.3 (c) Mark DeSmet, 1982,83,84,85
  4775.  
  4776.             (various error messages)
  4777.  
  4778.         end of PCCA  0016 code  0000 data  1% utilization
  4779.  
  4780.         The 'code' number is in hex and tells how many bytes of code were 
  4781.         produced.  The 'data' number is similar and tells how many bytes 
  4782.         of data were produced.  The utilization percentage shows how full 
  4783.         the symbol table was.
  4784.  
  4785.         Sample of list output:
  4786.  
  4787.         PCCA Assembler    BLIP.A
  4788.                          1      ;TOUPPER.A convert a charcter to upper case
  4789.                          2
  4790.                          3      CSEG
  4791.                          4      PUBLIC TOUPPER
  4792.                          5
  4793.                          6      ;  character = toupper(character)
  4794.                          7
  4795.         0000 5A          8      TOUPPER:POP     DX      ;RETURN ADDRESS
  4796.         0001 58          9            POP       AX      ;CHARACTER
  4797.         0002 3C61       10            CMP       AL,'a'  ;IF LOWER THAN 'a'
  4798.                         11            JC        TO_DONE ;DO NOTHING
  4799.         0004 3C7B       12            CMP       AL,'z'  ;OR IF ABOVE 'z'
  4800.                         13            JNC       TO_DONE ;DO NOTHING
  4801.         0006 2C20       14            SUB       AL,'a'-'A' ;ELSE ADJUST
  4802.         0008 B400       15      TO_DONE:MOV     AH,0    ;RETURN AN INT
  4803.         000A FFE2       16            JMP       DX      ;RETURN
  4804.  
  4805.  
  4806.  
  4807.         A.2.2. Messages Produced by PCCA
  4808.  
  4809.         PCCA prints two categories of messages: fatal errors and errors.  
  4810.         As with PCC, the fatal errors are caused by I/O errors or 
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.         Messages                                            Page 68
  4820.  
  4821.  
  4822.         similar.  Errors are simply syntax errors in using the language.   
  4823.         When a fatal error is detected, PCCA prints a message and stops.  
  4824.         An error does not stop the assembler, but it stops writing the 
  4825.         object module to run faster.  If errors are detected, the object 
  4826.         module is never good.
  4827.  
  4828.  
  4829.         A.2.2.1. Fatal Errors From PCCA
  4830.  
  4831.         cannot close <file> - the file could not be closed. An I/O error 
  4832.                         occurred.
  4833.  
  4834.         cannot create <file> - the named file could not be created. The 
  4835.                         name is a temporary name or the name of the 
  4836.                         object or list file.  This message usually means 
  4837.                         the drive is full (see 'T' option).
  4838.  
  4839.         cannot open <file> - the named source or include file could not 
  4840.                         be found.
  4841.  
  4842.         cannot read <file> - the named file could not be read. Usually 
  4843.                         means an I/O error was detected.
  4844.  
  4845.         cannot unlink <file> - the temporary file could not be deleted. 
  4846.                         An I/O error occurred.
  4847.  
  4848.         cannot write <file> - the named file could not be written. An I/O 
  4849.                         error was detected.  Usually means the disk drive 
  4850.                         is out of space.
  4851.  
  4852.         internal error in jump optimization - the assembler became 
  4853.                         confused optimizing branches.
  4854.  
  4855.         no input file   - no filename followed the PCCA when invoked.
  4856.  
  4857.         too  many labels - only 1000 names and labels are allowed.
  4858.  
  4859.         too many symbols - the assembler ran out of symbol space.  The 
  4860.                         source program should be broken into smaller 
  4861.                         modules.
  4862.  
  4863.  
  4864.  
  4865.         A.2.2.2. Errors from PCCA
  4866.  
  4867.         Error messages have the form:
  4868.  
  4869.             44  mov  #44,a3
  4870.             error: illegal mnemonic
  4871.  
  4872.         or, if the error was found in an include file:
  4873.  
  4874.             44  mov  #44,a3
  4875.             file:2:SCREEN.A  error: illegal mnemonic
  4876.  
  4877.  
  4878.  
  4879.  
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.         Messages                                            Page 69
  4886.  
  4887.  
  4888.         The messages are:
  4889.  
  4890.  
  4891.         address must be in DSEG - address constants  can only be in DSEG, 
  4892.                         because constants in CSEG are not fixed up at run 
  4893.                         time.
  4894.  
  4895.         bad DS value    - a constant expression must follow the DS.
  4896.  
  4897.         bad include     - the correct form for an include statement is:
  4898.  
  4899.                         include "filename"
  4900.  
  4901.         bad LINE value  - the line statement should be followed by a 
  4902.                         constant.
  4903.  
  4904.         cannot label PUBLIC - a 'public' statement cannot have a label.
  4905.  
  4906.         data offset must be an unsigned - an attempt was made to use an 
  4907.                         offset in a byte or long constant.  
  4908.  
  4909.         DS must have label - storage cannot be reserved without a name.
  4910.  
  4911.         DS must be in DSEG - storage can only be reserved in DSEG.
  4912.  
  4913.         duplicate label - the label on the line was defined previously.
  4914.  
  4915.         equate too deep - an 'equ' may reference a prior one, but only to 
  4916.                         a depth of four.
  4917.  
  4918.         illegal expression - the expression had an illegal operator or is 
  4919.                         somehow invalid.
  4920.  
  4921.         illegal operand - an operand had a type that was not legal in 
  4922.                         that context.
  4923.  
  4924.         illegal reserved word - a reserved word was found in the wrong 
  4925.                         context.
  4926.  
  4927.         illegal ST value - the index to a floating point stack element 
  4928.                         must be in the range 0 to 7.
  4929.  
  4930.         incorrect type  - only 'byte', 'word', 'dword', and 'tbyte', are 
  4931.                         allowed following the colon to type a public.
  4932.  
  4933.         impossible arithmetic - an arithmetic operation has operands 
  4934.                         incompatible with the 8086 architecture.
  4935.  
  4936.                         example:
  4937.  
  4938.                         add word [bx], word[si]
  4939.  
  4940.         in wrong segment - a variable or label is being defined in a 
  4941.                         segment different than the segment of the 
  4942.                         'public' statement.  Remember that 'public' 
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.         Messages                                            Page 70
  4952.  
  4953.  
  4954.                         statements must be in the correct segment, 
  4955.                         following 'dseg' or 'cseg' as appropriate.
  4956.  
  4957.         invalid BYTE constant - a byte constant was needed, but something 
  4958.                         else was found.
  4959.  
  4960.         invalid constant - the instruction needed a constant and 
  4961.                         something else was found.
  4962.  
  4963.         invalid DD constant - the value of a 'DD' must be a constant 
  4964.                         expression.
  4965.  
  4966.         invalid DW constant - the value of a 'DW' must be a constant 
  4967.                         expression or a variable name.  In the latter 
  4968.                         case, offset is assumed.  The statement:
  4969.  
  4970.                         dw   offset  zip
  4971.  
  4972.                         is illegal since offset is already implied.  Just 
  4973.                         use:
  4974.  
  4975.                         dw   zip
  4976.  
  4977.         invalid offset  - an offset of the expression cannot be taken.
  4978.  
  4979.         line too long   - the maximum input line to PCCA is 110 
  4980.                         characters.
  4981.  
  4982.         mismatched types - the types of the two operands must agree.
  4983.  
  4984.                         example:
  4985.  
  4986.                         db      chr
  4987.                         add     ax,bl           ;illegal
  4988.                         add     chr,ax          ;illegal
  4989.                         add     word chr,ax     ;legal
  4990.  
  4991.  
  4992.         misplaced reserved word - a reserved word was found in an 
  4993.                         expression.
  4994.  
  4995.         missing :       - the '?' operator was missing the colon part.
  4996.  
  4997.         missing )       - mismatched parenthesis.
  4998.  
  4999.         missing ]       - mismatched braces in an address expression.
  5000.  
  5001.         missing ':'     - labels to instructions must be followed by a 
  5002.                         colon.  This message also prints when a mnemonic 
  5003.                         is misspelled.  The assembler thinks that the bad 
  5004.                         mnemonic is a label without a colon.
  5005.  
  5006.         missing EQU name - an equate statement lacks a name.
  5007.  
  5008.         missing type    - the memory reference needs a type.  In the case 
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.         Messages                                            Page 71
  5018.  
  5019.  
  5020.                         of 'public's defined elsewhere, the type can be 
  5021.                         supplied by ':byte' or ':word' on the public 
  5022.                         statement.  In the case of anonymous references, 
  5023.                         the 'byte' or 'word' keyword must be used.
  5024.  
  5025.                         example:
  5026.  
  5027.                         public  a:byte
  5028.                         inc     a               ; illegal
  5029.                         inc     byte a          ; legal
  5030.                         inc     es:[bx]         ; illegal
  5031.                         inc     es:word[bx]     ; legal
  5032.  
  5033.         need constant   - something other than a constant expression 
  5034.                         followed a 'ret'.
  5035.  
  5036.         need label      - a jump relative was made to something other 
  5037.                         than a label.  'jmp's may be indirect but 'jz's 
  5038.                         etc. can only jump to a label.
  5039.  
  5040.         nested include  - an included file may not include another.
  5041.  
  5042.         not a label     - only names can be public.
  5043.  
  5044.         RB must have label - a 'RB' statement must have a label.
  5045.  
  5046.         RB must be in DS - 'RB's must follow a DSEG directive as they can 
  5047.                         only be in the data segment.  'DB's can be in the 
  5048.                         code segment.
  5049.  
  5050.         RW must be in DS - as above.
  5051.  
  5052.         too many arguments - the instruction had more operands than 
  5053.                         allowed or the last operand contains an illegal 
  5054.                         op-code.
  5055.  
  5056.         undefined variable <name> - the name is referred to but not 
  5057.                         defined or listed as public.
  5058.  
  5059.         unknown mnemonic - the mnemonic is illegal.
  5060.  
  5061.  
  5062.  
  5063.         A.3. PCCL Messages
  5064.  
  5065.  
  5066.         A.3.1. Banner and Termination Messages
  5067.  
  5068.         PCCL Linker PCC and PCCA   V1.2b  Copyright Mark DeSmet 1988
  5069.         end of PCCL        9% utilization
  5070.  
  5071.  
  5072.         A.3.2. Warnings from PCCL
  5073.  
  5074.         undefined PUBLIC - <name> - the name is referenced, but not 
  5075.  
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083.         Messages                                            Page 72
  5084.  
  5085.  
  5086.                         defined in any module.  PCCL will complete and 
  5087.                         the resulting .EXE module may execute as long as 
  5088.                         the undefined PUBLICs are not referenced.  If 
  5089.                         they are referenced, then the result is 
  5090.                         undefined.
  5091.  
  5092.  
  5093.         A.3.3. Fatal Errors from PCCL 
  5094.  
  5095.         PCCL prints the message, prints 'PCCL abandoned' and quits.
  5096.  
  5097.         bad argument    - an argument is illegal.
  5098.  
  5099.         bad object file<name> - the object or library file contains an 
  5100.                         illegal record.
  5101.  
  5102.         bad stack option - the 'S' option should be followed by one to 
  5103.                         four hex digits.
  5104.  
  5105.         cannot close <file> - I/O error occurred.
  5106.  
  5107.         cannot create <file> - I/O error or disk out of room.  On MS-DOS 
  5108.                         2.0 and later, make sure that the CONFIG.SYS file 
  5109.                         contains a FILES=20 command.
  5110.  
  5111.         cannot open <file> - the object file could not be found.  On MS-
  5112.                         DOS 2.0 and later, make sure that the CONFIG.SYS 
  5113.                         file contains a FILES=20 command.
  5114.  
  5115.         cannot read <file> - I/O error occurred.
  5116.  
  5117.         cannot seek <file> - I/O error occurred.
  5118.  
  5119.         cannot write <file> - I/O error or disk out of room.
  5120.  
  5121.         different segments for - <name> - the public is declared in 
  5122.                         different segments in different modules.  
  5123.                         Probably both as a function and as a variable.
  5124.  
  5125.         illegal overlay number - in the overlay options -Vnn and -Mnn, 
  5126.                         the value nn must be between 1 and 39 in 
  5127.                         ascending, consecutive order.
  5128.  
  5129.         multiply defined <name> - the same public appears in two modules.
  5130.  
  5131.         over 100 arguments - PCCL only allows 100 arguments, including 
  5132.                         arguments in -F files. 
  5133.  
  5134.         over 64K code   - a segment has over 64K of code. See the 
  5135.                         description of PCCL overlay support.
  5136.  
  5137.         over 64K data   - the resultant program has over 64K of data. 
  5138.                         This is not supported.  You will have to move 
  5139.                         some data to locals or use overlays.
  5140.  
  5141.  
  5142.  
  5143.  
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.         Messages                                            Page 73
  5150.  
  5151.  
  5152.         over 300 modules - only 300 modules can be linked together.  The 
  5153.                         supplied library only contains about 60 modules.
  5154.  
  5155.         too many filenames - there are only 2000 bytes reserved for all 
  5156.                         filenames.
  5157.  
  5158.         too many labels in <name> - a module in the named file had over 
  5159.                         1000 labels.
  5160.  
  5161.         too many total PUBLICS in <name> - symbol table has overflowed.  
  5162.                         The named file was being read when the overflow 
  5163.                         occurred.
  5164.  
  5165.  
  5166.  
  5167.  
  5168.  
  5169.  
  5170.  
  5171.  
  5172.  
  5173.  
  5174.  
  5175.  
  5176.  
  5177.  
  5178.  
  5179.  
  5180.  
  5181.  
  5182.  
  5183.  
  5184.  
  5185.  
  5186.  
  5187.  
  5188.  
  5189.  
  5190.  
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.         Order Form                                          Page 74
  5216.  
  5217.  
  5218.         B. Order Form
  5219.  
  5220.         Remit to: C Ware Corporation
  5221.                   P.O. Box 428
  5222.                   Paso Robles, CA 94447
  5223.  
  5224.         PCC version 1.2c
  5225.  
  5226.         You can also order by phone using your P.O.#, Mastercard or VISA.  
  5227.         (805) 239-4620, 9:00 a.m. - 4:00 p.m., PST ONLY.
  5228.  
  5229.         ____ PCC Registration .................... @ $ 30.00 ea  $ ______
  5230.              (includes registration software -OR- 
  5231.               latest version of PCC)
  5232.  
  5233.         ____ UPGRADE to the newest version .......  @ $ 5.00 ea  $ ______
  5234.              (includes latest version of the program diskette,
  5235.               with documentation on the disk.)
  5236.  
  5237.         Orders are normally shipped by USPS at no additional charge.
  5238.  
  5239.         For UPS shipment, please add $3.00            $  3.00 ea  $ _____
  5240.  
  5241.                                                        Subtotal    ______
  5242.  
  5243.                                                   Less Discount    ______
  5244.  
  5245.                                                            Total $ ______
  5246.  
  5247.  
  5248.  
  5249.         Payment by:  [ ] Check  [ ] MC  [ ] Visa  [ ] PO # ______________
  5250.  
  5251.         Name: ___________________________________________________________
  5252.  
  5253.         Company: ________________________________________________________
  5254.  
  5255.         Address: ________________________________________________________
  5256.  
  5257.                : ________________________________________________________
  5258.  
  5259.                : ________________________________________________________
  5260.  
  5261.         Day Phone: _______________________ Eve: _________________________
  5262.  
  5263.          Card #: _______________________________ Exp. Date: _____________
  5264.  
  5265.         Signature of cardholder: ________________________________________
  5266.  
  5267.  
  5268.  
  5269.  
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.  
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281.         User Comments                                       Page 75
  5282.  
  5283.  
  5284.         C. User Comments
  5285.  
  5286.         I acquired PCC from
  5287.                 [ ] - Friend                    [ ] - Software product
  5288.                 [ ] - Computer Club             [ ] - Computer Store
  5289.                 [ ] - Data Base Service         [ ] - Electronic BBS
  5290.                 [ ] - Other - Please Specify ____________________________
  5291.  
  5292.         We would also appreciate any input you would care to give 
  5293.         concerning PCC.  If you have any ideas or comments that would 
  5294.         make PCC a better program, then please let us know.
  5295.  
  5296.         We value your comments!
  5297.  
  5298.         Comments and/or suggestions:
  5299.         ________________________________________________________________
  5300.  
  5301.         ________________________________________________________________
  5302.  
  5303.         ________________________________________________________________
  5304.  
  5305.         ________________________________________________________________
  5306.  
  5307.         ________________________________________________________________
  5308.  
  5309.         ________________________________________________________________
  5310.  
  5311.         ________________________________________________________________
  5312.  
  5313.         ________________________________________________________________
  5314.  
  5315.         ________________________________________________________________
  5316.  
  5317.         ________________________________________________________________
  5318.  
  5319.         ________________________________________________________________
  5320.  
  5321.         ________________________________________________________________
  5322.  
  5323.         ________________________________________________________________
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341.  
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.         User Comments                                       Page 76
  5348.  
  5349.  
  5350.          index
  5351.  
  5352.         A
  5353.         abs(), 34
  5354.         An Introduction To PCC, 8
  5355.         atof(), 35
  5356.         atoi(), 34
  5357.         atol(), 35
  5358.  
  5359.         B
  5360.         Banner and Termination Messages, 60, 67, 71
  5361.         Basic System, 10
  5362.  
  5363.         C
  5364.         Calling Conventions, 29
  5365.         ceil(), 36
  5366.         chain(), 36
  5367.         close(), 37
  5368.         Completion Codes, 11
  5369.         Corporate
  5370.            Business, Government and Commercial Use, 5
  5371.         creat(), 37
  5372.  
  5373.         D
  5374.         Data Types, 15
  5375.         dates(), 37
  5376.         DISCLAIMER, 3
  5377.         Disk Input/Output Routines, 32
  5378.         doint(), 37
  5379.  
  5380.         E
  5381.         Errors from PCCA, 68
  5382.         Example, 21
  5383.         Examples, 14, 24
  5384.         exec(), 38
  5385.         exit(), 39
  5386.         exp(), 39
  5387.         Extensions, 16
  5388.         Externs, 18
  5389.  
  5390.         F
  5391.         fabs(), 40
  5392.         Fatal Errors From PCCA, 68
  5393.         Fatal Errors from PCCL, 72
  5394.         fclose(), 40
  5395.         fgetc(), 40
  5396.         fgets(), 40
  5397.         floor(), 41
  5398.         fopen(), 41
  5399.         FOREIGN RESHIPMENT LIABILITY, 3
  5400.         Forward References, 18
  5401.         fputc(), 41
  5402.         fputs(), 42
  5403.         frand(), 42
  5404.         fscanf(), 42
  5405.  
  5406.  
  5407.  
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.         User Comments                                       Page 77
  5414.  
  5415.  
  5416.  
  5417.         G
  5418.         General, 4
  5419.         getc(), 42
  5420.         getchar(), 43
  5421.         gets(), 43
  5422.         Getting Started, 9
  5423.         getw(), 44
  5424.  
  5425.         I
  5426.         IBM-PC Screen and Keyboard Interface, 34
  5427.         in(), 44
  5428.         index(), 44
  5429.         Introduction, 13, 21, 23, 28
  5430.         Invocation, 21, 23
  5431.  
  5432.         L
  5433.         Libraries, 27
  5434.         LIBRARY CONVENTIONS, 31
  5435.         License, 2
  5436.         LIMITATIONS OF REMEDIES, 3
  5437.         LIMITED WARRANTY                                                                , 3
  5438.         lmove(), 45
  5439.         log(), 44
  5440.         longjmp(), 45
  5441.  
  5442.         M
  5443.         Macros, 20
  5444.         Math Routines, 33
  5445.         Messages, 60
  5446.         Messages Produced by PCCA, 67
  5447.  
  5448.         N
  5449.         Names, 28
  5450.  
  5451.         O
  5452.         open(), 46
  5453.         Order Form, 74
  5454.         ORDERING INFORMATION, 4
  5455.         os(), 46
  5456.         out(), 46
  5457.         Overlays, 25
  5458.  
  5459.         P
  5460.         PCC -- The Personal C Compiler, 13
  5461.         PCC Compiler Messages, 60
  5462.         PCC Errors, 62
  5463.         PCC Fatal Errors, 60
  5464.         PCC Files, 9
  5465.         PCC Warnings, 66
  5466.         PCCA Assembler Messages, 67
  5467.         PCCA Errors ( from PCC Execution ), 67
  5468.         PCCL Messages, 71
  5469.         peek(), 46
  5470.         poke(), 47
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.         User Comments                                       Page 78
  5480.  
  5481.  
  5482.         pow(), 47
  5483.         Preface, 7
  5484.         Preprocessor directives, 15
  5485.         Program Initialization, 28
  5486.         putc(), 47
  5487.         putchar(), 47
  5488.         puts(), 48
  5489.         putw(), 48
  5490.  
  5491.         Q
  5492.         qsort(), 48
  5493.  
  5494.         R
  5495.         RAM DISK, 11
  5496.         rand(), 49
  5497.         rename(), 49
  5498.         rindex(), 49
  5499.  
  5500.         S
  5501.         scanf(), 50
  5502.         scr_aputs(), 52
  5503.         scr_ci(), 52
  5504.         scr_clr(), 52
  5505.         scr_clrl(), 52
  5506.         scr_cls(), 53
  5507.         scr_co(), 52
  5508.         scr_csts(), 53
  5509.         scr_cursoff(), 53
  5510.         scr_curson(), 53
  5511.         scr_rowcol(), 53
  5512.         scr_scdn(), 54
  5513.         scr_scrdn(), 54
  5514.         scr_scrup(), 54
  5515.         scr_scup(), 54
  5516.         scr_setmode(), 54
  5517.         scr_setup(), 55
  5518.         scr_sinp(), 55
  5519.         setjmp(), 56
  5520.         Setting Up DOS 2.xx
  5521.            3.xx, ..., 10
  5522.         Space Considerations, 25
  5523.         sqrt(), 56
  5524.         srand(), 56
  5525.         sscanf(), 57
  5526.         Standard Library Functions, 34
  5527.         strcat(), 57
  5528.         strcmp(), 57
  5529.         strcpy(), 57
  5530.         Strings, 20
  5531.         strlen(), 58
  5532.         strncat(), 58
  5533.         strncmp(), 58
  5534.         strncpy(), 59
  5535.         Support Policy, 2
  5536.  
  5537.  
  5538.  
  5539.  
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.         User Comments                                       Page 79
  5546.  
  5547.  
  5548.         T
  5549.         The C Language, 15
  5550.         The Legal Stuff, 1
  5551.         The PCCA 8088 Assembler, 21
  5552.         The PCCL Object File Linker, 23
  5553.         The PCCS.S Standard Library, 28
  5554.         times(), 59
  5555.         TRADEMARKS, 4
  5556.  
  5557.         U
  5558.         ungetc(), 59
  5559.         unlink(), 59
  5560.         Use by Educational Institutions, 5
  5561.         User Comments, 75
  5562.  
  5563.         W
  5564.         Warnings from PCCL, 71
  5565.  
  5566.         U
  5567.         Using Text
  5568.            Book, Magazine or Download source code, 8
  5569.  
  5570.  
  5571.  
  5572.  
  5573.  
  5574.  
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.  
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.  
  5608.  
  5609.  
  5610.  
  5611.